Article ID: 198300
Article Last Modified on 3/14/2005
Text1.Text = recordset!field_name & ""
Dim en As rdoEnvironment
Dim cn As rdoConnection
Dim rs As rdoResultset
Dim sql As String
sql = "Select * from pub_info"
Set en = rdoEngine.rdoEnvironments(0)
With en
.CursorDriver = rdUseOdbc
' uncomment the following line for first workaround
'.CursorDriver = rdUseClientBatch
End With
Dim cnStr As String
cnStr = "driver={SQL Server};server=myserver;" & _
"database=pubs;uid=<user name>;pwd=<strong password>"
Set cn = en.OpenConnection(DSName:="", Prompt:=rdDriverNoPrompt, _
Connect:=cnStr)
Set rs = cn.OpenResultset(sql, rdOpenDynamic, rdConcurValues, _
rdAsyncEnable)
While rs.StillExecuting
DoEvents
Wend
rs.MoveLast
MsgBox "RDO: " & Str(rs.RowCount) & " rows returned."
' Move back to first record.
rs.MoveFirst
' Uncomment the following two lines for the second workaround:
'Dim test As Variant
'test = rs!pr_info
' Check for null value before assigning.
If IsNull(rs!pr_info) Then
' Comment preceding line and uncomment following line for second
' workaround:
'If IsNull(test) Then
Text1.Text = ""
Else
' Assign value to text field if not NULL.
Text1.Text = rs!pr_info
' Comment preceding line and uncomment following line for second
' workaround:
'Text1.Text = test
End If
Do While Not rs.EOF
Debug.Print rs!pr_info
rs.MoveNext
Loop
rs.Close
cn.Close
en.Close
194975 HOWTO: Read and Write BLOBs Using GetChunk and AppendChunk
153238 HOWTO: Use GetChunk and AppendChunk Methods of RDO and ADO Object
Keywords: kbrdo kbprb KB198300