Dim i As Integer
Dim strConnectionString As String
strConnectionString = "Provider=SQLOLEDB; Data Source=127.0.0.1; Initial Catalog=Process; Integrated Security=SSPI;"
Dim strSql As String
'Stored Procedure:
strSql = "NewProcessFromOld_sp " & lstRecordList.Value
Dim objDatabase As ADODB.Connection
Dim objRecordset As ADODB.Recordset
Dim objCmd As ADODB.Command
Set objDatabase = New ADODB.Connection
objDatabase.Open (strConnectionString)
Set objCmd = New ADODB.Command
With objCmd
.CommandText = strSql
.CommandType = adCmdStoredProc
.ActiveConnection = objDatabase
End With
Set objRecordset = New ADODB.Recordset
objRecordset.Open objCmd, , adOpenStatic, , adCmdStoredProc
Do While Not objRecordset.EOF
i = objRecordset.Fields("NewID").Value
objRecordset.MoveNext
Loop
objRecordset.Close
objDatabase.Close
|