I have the following code:
Query analyzer shows 1 record, but thru VB6, I get true for both BOF and EOF and thus no result. Anyone see what I may have goofed?
Code:
Dim result As String
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
Dim var As String
cn.Open "Provider=sqloledb;" & _
"Data Source=server;" & _
"Initial Catalog=TR2Master;" & _
"User Id=id;" & _
"Password=pass"
rs.Open "select Long_Description from table where code= '" & strText & "'", cn ', adOpenDynamic, adLockOptimistic
'rs.MoveFirst
WriteToLog ("opened recordset: " & rs.EOF & " " & rs.BOF)
result = "No Description!"
Do Until rs.EOF = True
result = rs.Fields("Long_Description")
WriteToLog ("found record")
Loop
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
getDescription = result