Article ID: 166211
Article Last Modified on 6/29/2004
{ ? = call master.dbo.sp_addlogin(?,?) }
cn .Execute "Use Master" qr.SQL = "some sql to execute..." Set qr.ActiveConnection = cn qr .Execute cn .Execute "Use Pubs"
Private Sub Command1_Click()
Dim cn As New rdoConnection
Dim qr As New rdoquery
With cn
.Connect = "Driver={SQL Server};Server=MyServer;" & _
"Database=pubs;Uid=<username>;Pwd=<strong password>"
.EstablishConnection Prompt = rdDriverNoPrompt
End With
With qr
Set .ActiveConnection = cn
'Note: If you don't specify master, you will get the following
'error: "An invalid parameter was passed."
.SQL = "{ ? = call master.dbo.sp_addlogin(?,?) }"
.Prepared = True
.BindThreshold = 1024 'largest column that will be bound under
'ODBC.
Debug.Print .rdoParameters.Count
.rdoParameters(0).Direction = rdParamOutput
.rdoParameters(1).Direction = rdParamInput
.rdoParameters(2).Direction = rdParamInput
.rdoParameters(1) = "Edward"
.rdoParameters(2) = "Scissorhands"
.Execute
Debug.Print .rdoParameters(0).Value
'Const SQL_SUCCESS As Long = 0
'Const SQL_ERROR As Long = -1
End With
End Sub
Guide to Building Client Server Applications in Visual Basic (Enterprise)
Part 3: Data Access Options
Using Remote Data Objects and the Remote Data Control
Using RDO to Execute Stored Procedures
Additional query words: kbVBp500 kbVBp600 kbdse kbDSupport kbVBp kbODBC kbRDO
Keywords: kbhowto KB166211