Hello,
I have serached the internet how to access how many row there are in a table in a MS SQL database.
Does anybody have an example how to get the number of rows in a table ?
The code and table look like this:
String Value1
Test1 1
Test1 2
Test1 3
Test2 10
Test2 20
Test2 30
I run the SQL command:
SELECT Value1, FROM TestTable WHERE String='Test1'
And after this these commands:
RecordNum = objRecordset.RecordCount
FieldsNum = objRecordset.Fields.count
Value = objRecordset.Fields(0).Value
But the RecordCount returns -1 ? I can se that I that Value is set to 1 which is the first Test1 value. But why does the RecordCount returns -1 and not 3 ?
Cheers Gustaf
I have serached the internet how to access how many row there are in a table in a MS SQL database.
Does anybody have an example how to get the number of rows in a table ?
The code and table look like this:
String Value1
Test1 1
Test1 2
Test1 3
Test2 10
Test2 20
Test2 30
I run the SQL command:
SELECT Value1, FROM TestTable WHERE String='Test1'
And after this these commands:
RecordNum = objRecordset.RecordCount
FieldsNum = objRecordset.Fields.count
Value = objRecordset.Fields(0).Value
But the RecordCount returns -1 ? I can se that I that Value is set to 1 which is the first Test1 value. But why does the RecordCount returns -1 and not 3 ?
Cheers Gustaf