Article ID: 173991
Article Last Modified on 11/5/2003
Private Sub Command1_Click()
Dim Rs As rdoResultset
Dim Cn As rdoConnection
Dim strConnect As String
Dim Query1 As rdoQuery
strConnect = "Driver={SQL Server};Server=MyServer;" & _
"Database=pubs;Uid=<username>;Pwd=<strong password>"
rdoEnvironments(0).CursorDriver = rdUseClientBatch
Set Cn = rdoEnvironments(0).OpenConnection(dsName:="", _
Prompt:=rdDriverNoPrompt, ReadOnly:=False, Connect:=strConnect)
'To run without error, uncomment the next line and comment the
'following 2 lines.
'Set Query1 = Cn.CreateQuery("Query1", _
"SELECT au_id, au_lname, au_fname FROM authors")
Set Query1 = Cn.CreateQuery("Query1", _
"SELECT au_id, au_lname, au_fname FROM authors WHERE au_id = ?")
Cn.rdoQueries("Query1").rdoParameters(0) = "238-95-7766"
Set Rs = Cn.rdoQueries("Query1").OpenResultset(rdOpenStatic, _
rdConcurBatch)
Set Rs.ActiveConnection = Nothing ' This causes the error
Rs.MoveLast
Rs.MoveFirst
Do Until Rs.EOF
Debug.Print Rs(1)
Rs.MoveNext
Loop
Cn.Close
End Sub
Keywords: kbbug kbrdo kbpending KB173991