RecordSet is always EOF


I have a problem with my RecordSet always being EOF but only with a certain SQL command. With other SQL commands it works and my RecordSet is filled with data.

What happens is that as soon as my program reaches “while not rs.EOF” it skips the entire loop, meaning that rs was already EOF. If I use “select * from systables where tabid > 99” then data is added to the comboboxes.

My table looks like this:
id | lastname | firstname | dateofbirth | email | phone
0 | Blogs | Joe | 05.06.1957 | | 089 1111111

What I want to happen is that the column names for the table are put into the comboboxes.

Here’s my code:

[code] dim rs as recordset

’ we need that because without it, RS never works.
’ here’s why: “For this method to work, you need to have a property somewhere with SQLDatabaseMBS so Real Studio includes our SQLDatabase plugin which provides the RecordSet functionality.” - MBS
dim something as SQLDatabaseMBS = new SQLDatabaseMBS

dim cmd as SQLCommandMBS
cmd = new SQLCommandMBS

'cmd = new SQLCommandMBS(dbconnection, “select * from JWTestCustomers”)
cmd = new SQLCommandMBS(dbconnection, _
"SELECT colname " _
+ EndOfLine _
+ "FROM syscolumns,systables " _
+ EndOfLine _
+ "WHERE tabname = ‘JWTestCustomers’ " _
+ EndOfLine _
+ “and syscolumns.tabid=systables.tabid”)


if not cmd.isResultSet then
  msgbox("Error with isResultSet")
end if

if DBConnection.error then
end if

rs = cmd.AsRecordSet

while not rs.EOF

msgbox("Error: "+DBConnection.ErrorMessage)
end try[/code]

It means there was no matching data. Your sql is formatted correctly and does not produce an error. It just doesn’t match any records.

Thanks Tim. I just rewrote everything using FetchNext instead of RS only to discover that yes, it was because I was typing blogs and not Blogs.