0

Hei,
I have an Access database with a querry containing 40,000 rows.
When I use "SELECT (*) COUNT FROM Querr" in ExecuteScalar, I get only about half of the rows. However, whem I copy the contents of the querry to a Table, a get the full 40,000 number of rows.
Any suggestions?
Best regards,
Tom

2
Contributors
3
Replies
4
Views
9 Years
Discussion Span
Last Post by LizR
0

How are you doing the select? any chance you're getting every other row?

This is the code:

OleDbCommand test = conn.CreateCommand();
test.CommandText=
"SELECT COUNT(*) FROM expws3";
conn.Open();
int antall = (int)test.ExecuteScalar();

in which expws3 is the Access querry.

The exact number of rows is 43031 while I get only 24005 with this code.
I will try to use the same SQL statement that Access uses to build the Querry.
However, even if that works, it would be interesting to know what may cause this
difference.

0

Out of interest (not that it should make a difference) do you get the same result if instead of int you use Int32?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.