<% ' ExxcuteOptionEnum Const adExecuteNoRecords = 128 ' CommandTypeEnum Const adCmdText = 1 Const adCmdTable = 2 Const adCmdStoredProc = 4 ' CursorLocationEnum Values Const adUseServer = 2 Const adUseClient = 3 ' DataTypeEnum Const adBigInt = 20 Const adCurrency = 6 Const adChar = 129 Const adVarChar = 200 Const adInteger = 3 Const adTinyInt = 16 Const adSmallInt = 2 Const adBoolean = 11 Const adDate = 7 ' Date Value Const adDBDate = 133 ' Date Value ( yyyymmdd ) Const adDBTime = 134 ' Time Value ( hhmmss ) Const adDecimal = 14 Const adDouble = 5 Const adNumeric = 131 Const adSingle = 4 Const adLongVarChar = 201 ' 2147483647 Const adLongVarBinary = 205 ' 2147483647 Const adLongVarWChar = 203 ' 1073741823 Const adVarWChar = 202 Const adWChar = 130 ' ParameterDirectionEnum Const adParamInput = 1 ' Input Const adParamInputOutput = 3 ' Input / Output Const adParamOutput = 2 ' Output Const adParamReturnValue = 4 ' Return Const adUnsignedTinyInt = 17 Dim dbConn Dim ConnStr : ConnStr = "Provider=SQLOLEDB.1;Password=josedbpass@)!@!;Persist Security Info=True;User ID=taxdbadmin!;Initial Catalog=taxnet;Data Source=db.taxnet.co.kr,24020" Dim strQuery Sub DBConnSet(strDb) If UCase(strDb) = "CUB" Then ConnStr = "Provider=SQLOLEDB.1;Password=josedbpass@)!@#;Persist Security Info=True;User ID=academydbadmin#;Initial Catalog=inausCubeNew;Data Source=db.taxnet.co.kr,24020" '//inaus cub ElseIf UCase(strDb) = "MALL" Then ConnStr = "Provider=SQLOLEDB.1;Password=josedbpass@)!@#;Persist Security Info=True;User ID=academydbadmin#;Initial Catalog=inausmall;Data Source=db.taxnet.co.kr,24020" '//inaus mall ElseIf UCase(strDb) = "ACADEMY" Then ConnStr = "Provider=SQLOLEDB.1;Password=josedbpass@)!@#;Persist Security Info=True;User ID=academydbadmin#;Initial Catalog=inausacademy;Data Source=db.taxnet.co.kr,24020" '//inaus cub Else ConnStr = "Provider=SQLOLEDB.1;Password=josedbpass@)!@!;Persist Security Info=True;User ID=taxdbadmin!;Initial Catalog=taxnet;Data Source=db.taxnet.co.kr,24020" '//taxnet End If End Sub Sub DBOpen() Set dbConn = Server.CreateObject("ADODB.Connection") dbConn.Open ConnStr End Sub Sub DBClose() dbConn.Close Set dbConn = Nothing End Sub Sub Query(strSql, RowCount, Arr) Dim Rs on error resume next RowCount=-1 Set Rs = dbConn.Execute(strSql) Arr = Rs.getrows RowCount=ubound(Arr,2) Rs.Close Set Rs = Nothing If err.number>0 Then RowCount=-1 End Sub Sub dQuery(strSql, RowCount, Arr) Dim Rs err.clear on error resume next RowCount=0 Set Rs = Server.CreateObject("Adodb.Recordset") Rs.Open strSql, ConnStr, 0, 1 Arr = Rs.getrows RowCount=ubound(Arr,2) Rs.Close Set Rs = Nothing If err.number>0 Then RowCount=-1 End Sub Sub nQuery(strSql, RowCount, Cols, Arr) Dim Rs on error resume next RowCount=-1 Set Rs = dbConn.Execute(strSql) Cols = split(Replace(Rs.GetString(,,"<€>","<<€€>>",""),"<<€€>>",""),"<€>") Set Rs = Rs.NextRecordSet Arr = Rs.getrows RowCount=ubound(Arr,2) Rs.Close Set Rs = Nothing If err.number>0 Then RowCount=-1 End Sub Sub QueryNext(strSql, Rs, nxYn, RowCount, Arr) on error resume next RowCount=-1 If Trim(strSql) <> "" Then Set Rs = dbConn.Execute(strSql) Else Set Rs = Rs.NextRecordSet End If Arr = Rs.getrows RowCount=ubound(Arr,2) If UCase(nxYn) <> "Y" Then Rs.Close Set Rs = Nothing End If If err.number>0 Then RowCount=-1 End Sub Sub dQueryNext(strSql, Rs, nxYn, RowCount, Arr) on error resume next RowCount=-1 If Trim(strSql) <> "" Then Set Rs = Server.CreateObject("Adodb.Recordset") Rs.Open strSql, ConnStr, 0, 1 Else Set Rs = Rs.NextRecordSet End If Arr = Rs.getrows RowCount=ubound(Arr,2) If UCase(nxYn) <> "Y" Then Rs.Close Set Rs = Nothing End If If err.number>0 Then RowCount=-1 End Sub Sub cmdQuery(cmd, RowCount, Arr) Dim Rs err.clear on error resume next RowCount=0 Set Rs = Server.CreateObject("Adodb.Recordset") Rs.Open cmd Arr = Rs.getrows RowCount=ubound(Arr,2) Rs.Close Set Rs = Nothing If err.number>0 Then RowCount=-1 End Sub function GetString(strSql) Dim Rs on error resume next Set Rs = dbConn.Execute(strSql) If Rs.eof Then GetString = "" Else GetString = Rs.GetString End If Rs.Close Set Rs = Nothing End function Sub Detail(strSql, RowCount, Cols) Dim Rs Set Rs = dbConn.Execute(strSql) If Rs.EOF Then RowCount=-1 Else RowCount=0 Cols = split(Replace(Rs.GetString(,,"<€>","<<€€>>",""),"<<€€>>",""),"<€>") If UBound(Cols) < 0 Then ReDim Cols(1) : Cols(0) = "" End if Rs.Close Set Rs = Nothing End Sub Sub dDetail(strSql, RowCount, Cols) Dim Rs on error resume next Set Rs = Server.CreateObject("Adodb.Recordset") Rs.Open strSql, ConnStr, 0, 1 If Rs.EOF Then RowCount=-1 Else RowCount=0 Cols = split(Replace(Rs.GetString(,,"<€>","<<€€>>",""),"<<€€>>",""),"<€>") If UBound(Cols) < 0 Then ReDim Cols(1) : Cols(0) = "" End if Rs.Close Set Rs = Nothing End Sub Sub DetailNext(strSql, Rs, nxYn, RowCount, Cols) 'on error resume next If Trim(strSql) <> "" Then Set Rs = dbConn.Execute(strSql) Else Set Rs = Rs.NextRecordSet End If If Rs.EOF Then RowCount=-1 Else RowCount=0 Cols = split(Replace(Rs.GetString(,,"<€>","<<€€>>",""),"<<€€>>",""),"<€>") If UBound(Cols) < 0 Then ReDim Cols(1) : Cols(0) = "" End If If UCase(nxYn) <> "Y" Then Rs.Close Set Rs = Nothing End If End Sub Sub dDetailNext(strSql, Rs, nxYn, RowCount, Cols) 'on error resume next If Trim(strSql) <> "" Then Set Rs = Server.CreateObject("Adodb.Recordset") Rs.Open strSql, ConnStr, 0, 1 Else Set Rs = Rs.NextRecordSet End If If Rs.EOF Then RowCount=-1 Else RowCount=0 Cols = split(Replace(Rs.GetString(,,"<€>","<<€€>>",""),"<<€€>>",""),"<€>") If UBound(Cols) < 0 Then ReDim Cols(1) : Cols(0) = "" End If If UCase(nxYn) <> "Y" Then Rs.Close Set Rs = Nothing End If End Sub Sub Execute(strSql) dbConn.Execute strSql, ,adExecuteNoRecords End Sub Sub dExecute(strSql) DBOpen dbConn.Execute strSql, ,adExecuteNoRecords DBClose End Sub Function cmdOpen(cmdText, cmdType) Dim cmd If cmdType = 1 Then cmdType = adCmdText Else cmdType = adCmdStoredProc End If Set cmd = Server.CreateObject("ADODB.Command") With cmd .ActiveConnection = ConnStr .CommandText = cmdText .CommandType = cmdType '.Prepared = True '// 실행전 미리 컴파일 End With Set cmdOpen = cmd End Function Function cmdClose(cmd) Set cmd = nothing End Function '**************************************************************** '* 클래스 설명 : 프로시저 쿼리문 생성 '* Set spQuery = new StoredProcQuery '* spQuery.spName "Test" '* spQuery.addParm "@val1","1","null" '* strQuery = spQuery.getQuery() '* Set spQuery = Nothing '**************************************************************** Class StoredProcQuery Public strProc Public strQuery '// 생성자 Private Sub Class_Initialize() strProc = "" : strQuery = "" End Sub '// 소멸자 Private Sub Class_Terminate() strProc = "" : strQuery = "" End Sub Public Sub spName(strName) strProc = strName End Sub Public Sub addParm(strVariable, strValue, strNull) If Len(strQuery) > 0 Then strQuery = strQuery &", " If isNull(Replace(strValue,"'","")) Or Replace(strValue,"'","") = "" Then strQuery = strQuery & strVariable &" = "& strNull Else strQuery = strQuery & strVariable &" = "& strValue End If End Sub Public Function getQuery() getQuery = "EXEC "& strProc &" "& strQuery End Function End Class %>