[ACCEPTED]-How to check all fields of the recordset from ADO query?-ado
First off, Debug.Print
prints to the Immediate Window 11 in the VB[A] Editor. If it's not showing, press 10 Ctrl-G.
Second, there is no single command 9 to show the whole record, you'll have to 8 assemble it the way that Xavinou does in 7 his (her?) answer. Here's the VB syntax, ignoring 6 recordset creation & EOF check (Note 5 that I've declared the variables--you are 4 using Option Explicit, yes?):
Dim fld As Field
Dim msg As String
For Each fld In rstRecordSet.Fields
msg = msg & fld.Value & "|"
Next
Debug.Print msg 'or MsgBox msg
I think the 3 pipe ("|") makes a better separator than 2 a space, since it's less likely to occur 1 in your data.
For the output console, I don't know (since 4 I don't know VB), but for showing the whole 3 record at once, you can use a foreach
loop on rstRecordSet.Fields
.
In 2 C#, I would write it like :
string msg = "";
foreach (Field f in rstRecordSet.Fields)
{
msg += f.Value + " ";
}
MessageBox.Show(msg);
Now, you just 1 have to find the VB syntax...
Instead of building your own string, piece 3 by piece, you can use the GetString method of the Recordset object:
Debug.Print records.GetString(adClipString, 1)
An unfortunate 2 side effect of this method is that it seems 1 to remove the record from the record set.
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.