Reputation: 65
Hey here my problems i'm calling a stored proc and I put the record into an ADODB RecordSet. When i Check the field.count its say i got 6 result which is good. But when i try to loop into that record set it skips one of them. Heres my code
oRs = g_oSQL.GetRecords("PS_palFetchAllPalette_sel")
If Not oRs Is Nothing Then
cmbPallet.Items.Clear()
oRs.MoveFirst()
While Not oRs.EOF
If oRs.Fields.Item("palcode").Value.ToString() <> "None" Then
cmbPallet.Items.Add(oRs.Fields.Item("palcode").Value.ToString())
End If
oRs.MoveNext()
End While
Upvotes: 0
Views: 5210
Reputation: 399
I think what happens is when you reach your last record with oRs.MoveNext() then you are at EOF so next loop won't happen. try to change the structure of the loop.
With oRs
Do Until .EOF
'get your data
.MoveNext
Loop
End With
Upvotes: 2
Reputation: 2297
I haven't worked with ADODB for a while but wouldn't field.count indicate the number of fields in the recordset and not the number of records returned? You could have returned 0 records but still have the metadata on the query.
Are you sure your check for "None" is working? This would require that palcode not ne empty or Null but have the actual value of "None." Set a breakpoint inside the While loop and see if your are getting what you expected.
Upvotes: 1