日期:2014-05-16 浏览次数:20964 次
<%
Class clsDBHelper
Private DefaultConnString
Private DefaultConnection
private sub Class_Initialize()
'DefaultConnString =
DefaultConnString = Application("DBConnString")
Set DefaultConnection = Nothing
End Sub
Public Function ExecSPReturnRS(spName, params, connectionString)
If IsObject(connectionString) Then
If connectionString is Nothing Then
If DefaultConnection is Nothing Then
Set DefaultConnection = CreateObject("ADODB.Connection")
DefaultConnection.Open DefaultConnString
End If
Set connectionString = DefaultConnection
End If
End If
Set rs = CreateObject("ADODB.RecordSet")
Set cmd = CreateObject("ADODB.Command")
cmd.ActiveConnection = connectionString
cmd.CommandText = spName
cmd.CommandType = adCmdStoredProc
Set cmd = collectParams(cmd, params)
'cmd.Parameters.Refresh
rs.CursorLocation = adUseClient
rs.Open cmd, ,adOpenStatic, adLockReadOnly
For i = 0 To cmd.Parameters.Count - 1
If cmd.Parameters(i).Direction = adParamOutput OR cmd.Parameters(i).Direction = adParamInputOutput OR cmd.Parameters(i).Direction = adParamReturnValue Then
If IsObject(params) Then
If params is Nothing Then
Exit For
End If
Else
params(i)(4) = cmd.Parameters(i).Value
End If
En