%
'//ÀÔÃâ·Â Á¦¾î
Class objDB_Modify
Private objQuery
Private Sub Class_Initialize()
'//Create Objects
Set objQuery = GetDBConn()
End Sub
Private Sub Class_Terminate()
Call CloseDBConn(objQuery) '//End
End Sub
Public Sub subExecInsert(byVal pTableName, byRef arrFieldName, byRef arrFieldValue)
On Error Resume Next
'//Transaction Start
objQuery.BeginTrans
Dim strQuery, strKeyQuery, strValQuery
strQuery = " INSERT INTO " & pTableName
strKeyQuery = " ("
strValQuery = " ("
Dim i
Dim tempName, tempVal
For i=0 to Ubound(arrFieldName, 1)
If Left(Trim(arrFieldName(i)), 1) = "S" Then
tempName = tempName & Mid(Trim(arrFieldName(i)), 3) & ", "
tempVal = tempVal & " '" & arrFieldValue(i) & "', "
Else
tempName = tempName & Mid(Trim(arrFieldName(i)), 3) & ", "
tempVal = tempVal & arrFieldValue(i) & ", "
End If
Next
tempName = Left(tempName, Len(tempName) - 2)
tempVal = Left(tempVal, Len(tempVal) - 2)
strKeyQuery = strKeyQuery & tempName & ") "
strValQuery = strValQuery & tempVal & ") "
strQuery = strQuery & strKeyQuery & " VALUES " & strValQuery
'Response.write strQuery
'Response.end
Dim sInsertQuery
sInsertQuery = strQuery
objQuery.Execute(sInsertQuery)
If objQuery.Errors.Count <> 0 Then '¿¡·¯°¡ ¹ß»ýÇß´Ù¸é...
objQuery.RollbackTrans
Response.write sInsertQuery
Response.end
Call CloseDBConn(objQuery)
Response.Write ""
Else
objQuery.CommitTrans
End if
End Sub
Public Sub subExecUpdate(byVal pTableName, byRef arrFieldName, byRef arrFieldValue, byVal pStrWhereCondition)
On Error Resume Next
'//Transaction Start
objQuery.BeginTrans
Dim strQuery
strQuery = " UPDATE " & pTableName
strQuery = strQuery & " SET "
Dim i
Dim tempStr
For i=0 to Ubound(arrFieldName, 1)
If Left(Trim(arrFieldName(i)), 1) = "S" Then
tempStr = tempStr & Mid(Trim(arrFieldName(i)), 3) & " = " & " '" & arrFieldValue(i) & "', "
Else
tempStr = tempStr & Mid(Trim(arrFieldName(i)), 3) & " = " & arrFieldValue(i) & ", "
End If
Next
strQuery = strQuery & tempStr
strQuery = Left(strQuery, Len(strQuery) - 2)
strQuery = strQuery & " WHERE " & pStrWhereCondition
Dim sUpdateQuery
sUpdateQuery = strQuery
'Response.write sUpdateQuery
'Response.end
objQuery.Execute sUpdateQuery
If objQuery.Errors.Count <> 0 Then '¿¡·¯°¡ ¹ß»ýÇß´Ù¸é...
objQuery.RollbackTrans
Response.write sUpdateQuery
'Response.end
Call CloseDBConn(objQuery)
Response.Write ""
Else
objQuery.CommitTrans
End if
End Sub
Public Sub subExecDelete(byVal pTableName, byVal pStrWhereCondition)
On Error Resume Next
'//Transaction Start
objQuery.BeginTrans
Dim strQuery
strQuery = "DELETE " & pTableName & " WHERE " & pStrWhereCondition
objQuery.Execute(strQuery)
If objQuery.Errors.Count <> 0 Then '¿¡·¯°¡ ¹ß»ýÇß´Ù¸é...
objQuery.RollbackTrans
Call CloseDBConn(objQuery)
Response.Write ""
Else
objQuery.CommitTrans
End If
End Sub
End Class
Sub subOpenComModify(byRef objModify)
Set objModify = New objDB_Modify
End Sub
' -----------------------------------------------------------------------------
' GetDBRecordset
'
' Description:
'
' Parameters:
'
' Returns:
' Object(Recordset)
' Notes :
' none
' -----------------------------------------------------------------------------
Function GetDBRecordset()
Set GetDBRecordset = Server.CreateObject("ADODB.Recordset")
End Function
' -----------------------------------------------------------------------------
' rsGetDBResult
'
' Description:
'
' Parameters:
' oConn - ADO Connection Object
' sQuery - DB Query String
' Returns:
' Object(Recordset)
' Notes :
' none
' -----------------------------------------------------------------------------
FUNCTION rsGetDBResult(byRef oConn, sQuery)
' -- ADO cursor types
Const AD_OPEN_FORWARD_ONLY = 0
Const AD_OPEN_KEYSET = 1
Const AD_OPEN_DYNAMIC = 2
Const AD_OPEN_STATIC = 3
' -- ADO lock types
Const AD_LOCK_READ_ONLY = 1
Const AD_LOCK_PESSIMISTIC = 2
Const AD_LOCK_OPTIMISTIC = 3
Const AD_LOCK_BATCH_OPTIMISTIC = 4
Dim rsResult
SET rsResult = GetDBRecordset()
SET rsResult = oConn.Execute(sQuery)
'rsResult.Open oConn, sQuery, nCursorType, nLockType
SET rsGetDBResult = rsResult
END FUNCTION
' -----------------------------------------------------------------------------
' arrGetDBResult
'
' Description:
'
' Parameters:
' oConn - ADO Connection Object
' sQuery - DB Query String
' Returns:
' Array
' Notes :
' none
' -----------------------------------------------------------------------------
FUNCTION arrGetDBResult(byRef oConn, sQuery)
Dim rsResult
SET rsResult = GetDBRecordset()
'response.write sQuery
'Response.end
SET rsResult = oConn.Execute(sQuery)
'rsResult.Open oConn, sQuery, nCursorType, nLockType
If rsResult.EOF Then
arrGetDBResult = Empty
Else
arrGetDBResult = rsResult.GetRows
End If
END FUNCTION
' -----------------------------------------------------------------------------
' CloseDBConn
'
' Description:
'
' Parameters:
' oConn - ADO Connection Object
' Returns:
' none
' Notes :
' none
' -----------------------------------------------------------------------------
Sub CloseDBConn(byRef oConn)
Set oConn = Nothing
End Sub
' -----------------------------------------------------------------------------
' Function Name : FuncObjDictionary
' Description : Dictionary Object »ý¼º
' Parameters : None
' Returns : Object(Dictionary)
' Notes : None
' -----------------------------------------------------------------------------
Function FuncObjDictionary()
Set FuncObjDictionary = CreateObject("Scripting.Dictionary")
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncObjGUID
' Description : GUID(Global Unique IDentifiers) »ý¼º
' Parameters : None
' Returns : Object(GUID)
' Notes : None
' -----------------------------------------------------------------------------
Function FuncObjGUID()
Dim ObjGenGuid
Set ObjGenGuid = Server.CreateObject("Scriptlet.Typelib")
FuncObjGUID = ObjGenGuid.guid
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncStrCurrentPage
' Description : ÇöÀç ÆäÀÌÁö ±¸Çϱâ
' Parameters : None
' Returns : String
' Notes : None
' -----------------------------------------------------------------------------
Function FuncStrCurrentPage()
FuncStrCurrentPage = Request.ServerVariables("SCRIPT_NAME")
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncConvertChar
' Description : HTML ÀμƮ ½Ã String º¯È¯Ã³¸®
' Parameters : pstrVal - ÀÔ·Â ¹ÞÀº °ª
' Returns : String
' Notes : None
' -----------------------------------------------------------------------------
Function FuncConvertChar(byVal pstrVal)
pstrVal = Replace(pstrVal, "&", "&")
pstrVal = Replace(pstrVal, "<", "<")
pstrVal = Replace(pstrVal, ">", ">")
pstrVal = Replace(pstrVal, "'", "''")
pstrVal = Replace(pstrVal, "|", "|")
pstrVal = Replace(pstrVal, Chr(13)&Chr(10), "
")
FuncConvertChar=pstrVal
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncDelComma
' Description : ³Ñ°Ü¹ÞÀº ¹®ÀÚ¿ÀÇ ÄÞ¸¶¸¦ Á¦°ÅÇÑ´Ù.
' Parameters : pstrVal - ÀÔ·Â ¹ÞÀº °ª
' Returns : String
' Notes : None
' -----------------------------------------------------------------------------
Function FuncDelComma(pstrVal)
Dim arrVal
Dim i
Dim TmpVal
arrVal = Split(pstrVal, ",")
For i = 0 to Ubound(arrVal)
TmpVal = TmpVal + arrVal(i)
Next
FuncDelComma = Trim(TmpVal)
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncConvertInput (DB Insert ¿ë)
' Description : ³Ñ°Ü¹ÞÀº ¹®ÀÚ¿ÀÇ /¸¦ Á¦°ÅÇϰí ÀÏ/¿ù/³âÀ¸·Î °¡Á®¿Â µ¥ÀÌÅ͸¦ ³â/¿ù/ÀÏ ¼øÀ¸·Î ¹Ù²Û´Ù.
' Parameters : pstrVal - ÀÔ·Â ¹ÞÀº °ª
' Returns : String
' Notes : None
' -----------------------------------------------------------------------------
Function FuncConvertInput(pstrVal)
Dim arrVal
Dim i
Dim TmpVal
Dim strYYYY
Dim strMM
Dim strDD
arrVal = Split(pstrVal, "/")
For i = 0 to Ubound(arrVal)
TmpVal = TmpVal + arrVal(i)
Next
strYYYY = Right(Trim(TmpVal), 4)
strMM = Mid(Trim(TmpVal), 3, 2)
strDD = Left(Trim(TmpVal), 2)
TmpVal = strYYYY&strMM&strDD
'//Response.write TmpVal
'//Response.end
FuncConvertInput = Trim(TmpVal)
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncConvertOutput (Display¿ë)
' Description : ³â/¿ù/ÀÏ·Î ÀúÀåµÈ Data¸¦ Display¿ëÀÎ ÀÏ/¿ù/³â À¸·Î ¹Ù²Û´Ù.
' Parameters : pstrVal - ÀÔ·Â ¹ÞÀº °ª
' Returns : String
' Notes : None
' -----------------------------------------------------------------------------
Function FuncConvertOutput(pstrVal)
Dim TmpVal
Dim strYYYY
Dim strMM
Dim strDD
strYYYY = Right(Trim(pstrVal), 4)
strMM = Left(Trim(pstrVal), 2)
strDD = Mid(Trim(pstrVal), 3, 2)
TmpVal = strMM&"/"&strDD&"/"&strYYYY
FuncConvertOutput = Trim(TmpVal)
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncCurDate
' Description : ÇöÀ糯¥¸¸ ±¸Çϱâ(- Á¦¿Ü)
' Parameters : None
' Returns : String
' Notes : None
' -----------------------------------------------------------------------------
Function FuncCurDate()
Dim strDate
Dim arrDate
Dim tempMonth
Dim tempDay
strDate = DATE()
arrDate = Split(strDate, "/")
IF Len(Trim(arrDate(0))) > 1 Then
tempMonth = Trim(arrDate(0))
Else
tempMonth = "0" & Trim(arrDate(0))
End IF
IF Len(Trim(arrDate(1))) > 1 Then
tempDay = Trim(arrDate(1))
Else
tempDay = "0" & Trim(arrDate(1))
End IF
FuncCurDate = tempMonth & tempDay & Trim(arrDate(2))
End Function
Function FuncCurDate2()
Dim strDate
Dim arrDate
Dim tempMonth
Dim tempDay
strDate = DATE()
arrDate = Split(strDate, "/")
IF Len(Trim(arrDate(0))) > 1 Then
tempMonth = Trim(arrDate(0))
Else
tempMonth = "0" & Trim(arrDate(0))
End IF
IF Len(Trim(arrDate(1))) > 1 Then
tempDay = Trim(arrDate(1))
Else
tempDay = "0" & Trim(arrDate(1))
End IF
FuncCurDate2 = Trim(arrDate(2)) & tempMonth & tempDay
End Function
Function FuncCurDateOrder()
Dim strDate
Dim arrDate
Dim tempMonth
Dim tempDay
strDate = DATE()
'Response.write strDate & "
"
'Response.end
arrDate = Split(strDate, "/")
IF Len(Trim(arrDate(0))) > 1 Then
tempMonth = Trim(arrDate(0))
Else
tempMonth = "0" & Trim(arrDate(0))
End IF
IF Len(Trim(arrDate(1))) > 1 Then
tempDay = Trim(arrDate(1))
Else
tempDay = "0" & Trim(arrDate(1))
End If
'//Response.write Trim(arrDate(2)) & tempMonth & tempDay & "
"
FuncCurDateOrder = Trim(arrDate(2)) & tempMonth & tempDay
End Function
' -----------------------------------------------------------------------------
' Function Name : FuncCurDate2
' Description : ÇöÀ糯¥ ±¸Çϱâ(- ¸¦ / ·Î ġȯ) MM/DD/YYYY
' Parameters : None
' Returns : String
' Notes : None
' -----------------------------------------------------------------------------
Function FuncCurDate2()
Dim strDate
strDate = Left(NOW(), 8)
strDate = Replace(strDate, "-", "/")
FuncCurDate2 = strDate
End Function
Sub SubCalStartEnd(byVal pFormName, byVal pSequence, byVal pStart, byVal pFinish)
%>
~ |