최초등록
This commit is contained in:
@@ -0,0 +1,168 @@
|
||||
<%
|
||||
' ************************
|
||||
' 2.DB관련
|
||||
' ************************
|
||||
'
|
||||
'function RequestAll(R_Fields, RequestObj) '변수한번에 요청하기
|
||||
'Function InsertQuery(R_Fields, table) 'insert 쿼리문 생성기
|
||||
'Function UpdateQuery(R_Fields, table, where) 'update 쿼리문 생성기
|
||||
'Function SelectQuery(R_Fields, table, where) 'select 쿼리문 생성기
|
||||
'Function arr2Value(R_Fields, arrObj, recordcount) '레코드셋에 필드명대로 변수만들기
|
||||
|
||||
'************** Information ****************************************
|
||||
' Program Title : 변수한번에 요청하기
|
||||
' Company :
|
||||
' Creator : 최 경 수 2007-03-08
|
||||
'*********************************************************************
|
||||
'
|
||||
'변수가 많지 않을때는 가급적 사용 자제
|
||||
'ex) RequestAll("filed1, filed2", "Request.Form")
|
||||
|
||||
function RequestAll(R_Fields, RequestObj)
|
||||
|
||||
Dim R_Fields_arr
|
||||
Dim sql, rs, i
|
||||
|
||||
R_Fields = Replace(R_Fields, " ", "")
|
||||
R_Fields_arr = Split(R_Fields, ",")
|
||||
|
||||
If RequestObj="" Then RequestObj = "request"
|
||||
|
||||
For i=0 To UBound(R_Fields_arr)
|
||||
execute(" "& R_Fields_arr(i) &" = InputValue("&RequestObj&"("""&R_Fields_arr(i)&""")) ")
|
||||
next
|
||||
|
||||
End function
|
||||
|
||||
|
||||
|
||||
|
||||
'필드가 많지 않을때는 가급적 사용 자제
|
||||
'ex) InsertQuery "filed1, filed2", "table"
|
||||
|
||||
Function InsertQuery(R_Fields, table)
|
||||
Dim i, R_Fields_arr
|
||||
R_Fields = Replace(R_Fields, " ", "")
|
||||
R_Fields_arr = Split(R_Fields, ",")
|
||||
|
||||
execute("sql = ""insert into "&table&"("&R_Fields&") values(""")
|
||||
|
||||
For i = 0 To UBound(R_Fields_arr)
|
||||
|
||||
execute("sql = sql & ""'""&"&R_Fields_arr(i)&"&""'""")
|
||||
|
||||
If i < UBound(R_Fields_arr) Then sql = sql & ","
|
||||
next
|
||||
execute("sql = sql & "")""")
|
||||
'response.write sql
|
||||
'Response.end
|
||||
|
||||
Dbcon.Execute sql
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
'************** Information ****************************************
|
||||
' Program Title : update 쿼리문 생성기
|
||||
' Company :
|
||||
' Creator : 2008-05-31
|
||||
'*********************************************************************
|
||||
'
|
||||
'필드가 많지 않을때는 가급적 사용 자제
|
||||
'ex) UpdateQuery "filed1, filed2", "table", "where idx = 1"
|
||||
|
||||
Function UpdateQuery(R_Fields, table, where)
|
||||
|
||||
Dim i, R_Fields_arr
|
||||
R_Fields = Replace(R_Fields, " ", "")
|
||||
R_Fields_arr = Split(R_Fields, ",")
|
||||
|
||||
execute("sql = ""update "&table&" set """)
|
||||
|
||||
For i = 0 To UBound(R_Fields_arr)
|
||||
|
||||
execute("sql = sql & """&R_Fields_arr(i)&" = '""&"&R_Fields_arr(i)&"&""'""")
|
||||
|
||||
If i < UBound(R_Fields_arr) Then sql = sql & ","
|
||||
next
|
||||
execute("sql = sql & "" "" & where")
|
||||
'response.write sql
|
||||
'response.end
|
||||
Dbcon.Execute sql
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
'************** Information ****************************************
|
||||
' Program Title : select 쿼리문 생성기
|
||||
' Company :
|
||||
' Creator : 2008-05-31
|
||||
'*********************************************************************
|
||||
'필드가 많지 않을때는 가급적 사용 자제
|
||||
'ex) SelectQuery "filed1, filed2", "table", "where idx = 1"
|
||||
Function SelectQuery(R_Fields, table, where)
|
||||
|
||||
Dim i, R_Fields_arr, rs
|
||||
R_Fields = Replace(R_Fields, " ", "")
|
||||
R_Fields_arr = Split(R_Fields, ",")
|
||||
|
||||
execute("sql = ""select "&R_Fields&" from "" & table & "" "" & where")
|
||||
' response.write sql
|
||||
' response.End
|
||||
|
||||
Set rs = Dbcon.Execute( sql )
|
||||
|
||||
If rs.bof Or rs.eof Then
|
||||
SelectQuery = false
|
||||
Else
|
||||
SelectQuery = true
|
||||
For i = 0 To UBound(R_Fields_arr) '전역변수에 담기
|
||||
execute( R_Fields_arr(i) & "= rs("""&R_Fields_arr(i)&""")")
|
||||
'execute("response.write """&R_Fields_arr(i)&"=""&"&R_Fields_arr(i)&"&""<br>""")
|
||||
Next
|
||||
End if
|
||||
|
||||
Set rs = nothing
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
|
||||
'************** Information ****************************************
|
||||
' Program Title : 레코드셋에 필드명대로 변수만들기
|
||||
' Company : 나눔아이앤씨
|
||||
' Creator : 최 경 수 2010-02-26
|
||||
'*********************************************************************
|
||||
'ex) arr2Value Rs
|
||||
Function arr2Value(R_Fields, arrObj, recordcount)
|
||||
|
||||
Dim i, R_Fields_arr
|
||||
R_Fields = Replace(R_Fields, " ", "")
|
||||
R_Fields_arr = Split(R_Fields, ",")
|
||||
|
||||
For i = 0 To UBound(R_Fields_arr)
|
||||
|
||||
execute(R_Fields_arr(i)&" = "&arrObj&"("&i&","&recordcount&")")
|
||||
'response.write R_Fields_arr(i)&" = "&eval(arrObj&"("&i&","&recordcount&")")&"<br>"
|
||||
|
||||
next
|
||||
|
||||
End Function
|
||||
|
||||
Function arr2Search(arrObj, idx, fieldCount) '2차원 배열 idx값으로 원하는 값 검색
|
||||
Dim i
|
||||
arr2Search = ""
|
||||
If Not( IsNull( arrObj ) ) Then
|
||||
For i =0 To UBound(arrObj, 2)
|
||||
If Cstr( arrObj(0,i) ) = CStr(idx) Then
|
||||
arr2Search = arrObj(fieldCount,i)
|
||||
Exit for
|
||||
End if
|
||||
Next
|
||||
End if
|
||||
End function
|
||||
%>
|
||||
Reference in New Issue
Block a user