Article ID: 188558
Article Last Modified on 3/14/2006
197177 INF: How to Obtain SQL Server 6.5 Service Pack 5a
CREATE PROCEDURE tds_sp AS
CREATE table #test(col1 varchar(10), col2 int)
INSERT INTO #test values('test', 1)
SELECT * FROM #test
DROP TABLE #test
GO
Private Sub Command1_Click()
Dim oRs As New ADODB.Recordset
Dim sCn As String
Dim sExecute As String
On Error GoTo errorhandler
sCn = "DSN=pubs;uid=UserName;pwd=StrongPassword;"
sExecute = "tds_sp"
oRs.CursorLocation = adUseClient
oRs.Open sExecute, sCn, adOpenStatic, adLockBatchOptimistic
While Not oRs.EOF
Debug.Print oRs.Fields(1).Value
oRs.MoveNext
Wend
Set oRs = Nothing
Exit Sub
errorhandler:
MsgBox "Error No.: " & Err.Number & vbLf & _
"Error: " & Err.Description
Set oRs = Nothing
End Sub
Dim oRs As New ADODB.Recordset
Dim oCn As New ADODB.Connection
Dim oCm As New ADODB.Command
Dim sCn As String
Dim sExecute As String
On Error GoTo errorhandler
sCn = "DSN=pubs;uid=UserName;pwd=StrongPassword;"
sExecute = "tds_sp"
oCn.Open sCn
oCn.CursorLocation = adUseClient
oCm.ActiveConnection = oCn
oCm.CommandType = adCmdStoredProc
oCm.CommandText = "tds_sp"
'Set oRs = oCm.Execute
oRs.Open oCm, , adOpenStatic, adLockBatchOptimistic
'oRs.CursorLocation = adUseClient
'oRs.Open sExecute, sCn, adOpenStatic, adLockBatchOptimistic
While Not oRs.EOF
Debug.Print oRs.Fields(0).Value
oRs.MoveNext
Wend
Set oRs = Nothing
Exit Sub
errorhandler:
MsgBox "Error No.: " & Err.Number & vbLf & _
"Error: " & Err.Description
Set oRs = Nothing
Additional query words: adobj kbado TDS protocol error kbDSupport kbdse kbSQLServ
Keywords: kbbug kbfix kbstoredproc kbdatabase KB188558