MISSING ACCESS RECORDS

  • Thread starter Thread starter TompIfe
  • Start date Start date
T

TompIfe

Hi,
I have an Access database with a querry containing about 40,000 rows.
Using:

OleDbCommand test = conn.CreateCommand();
test.CommandText=

"SELECT COUNT(*) FROM expws3";

conn.Open();

int antall = (int)test.ExecuteScalar();

only 20,000 rows are returned. 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
 
Hello TompIfe,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you. After reading your
post carefully, I do the following test and research on my side:

I have created a simple access database which has a table and a query of
the table in it. There are 40,000 rows in the query. I use the exactly same
codes you post to get the row count of query. But it returns the correct
count number.

This issue is not a general one and I do not find a similar report before.
To work the issue out, it needs both our sides' efforts. So it is necessary
for us to collect some information to troubleshoot.

Here are some points we need to clarify at the moment:

1.What is the version of Access and have you applied the newest services
pack of Office products. I test on Access 2003 SP3 and Access 2007 SP1, and
the row count always returns correctly.

2.How is the query expws3 created? Is it generated from several tables and
some complicated relationships? If the expws3's creating is not supposed to
be discussed in public, please feel free to send me emails about this
information to (e-mail address removed). After getting the info of expws3, I
will try again to reproduce the symptom according to the definition of the
query.

3.After the expw3 is created, have we modified any based table's structure?
I ask this question because a similar issue in SQL Server was reported.
That issue resulted from the DataView's Schema was not updated after its
based table's schema was modified.

4.If you can provide the reproducible Access database and sent it to me,
that will be helpful for us to have a clearer picture of the issue.

I know there are many questions asked in a time, but they are needed to
narrow down the problem. Thanks for your understanding on this.

Also, here are some suggestions you can try on your side:

1.Make sure the Access file is saved before we use the code to retrieve
data from Access database. The retrieved data will not be updated one
unless we save the Access database file.

2.Execute the sql command "Select * from expws3" with test.ExecuteReader()
and use a loop to find how many rows exist in the returned reader. Codes
look like:
OleDbCommand test = con.CreateCommand();
test.CommandText = "Select * from expws3";
con.Open();

int count = 0;
OleDbDataReader reader = test.ExecuteReader();
while (reader.Read())
{
count++;
}
Debug.Print(count.ToString());

con.Close();

3. Duplicate the current db's schema to a new access db. Input a small
number of rows into it for test, and see whether the query works correctly
when the row count is small.

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 
Hello Tom,

I am writing to check the status of the issue on your side. Could you
please let me know if the suggestion works for you or not? If you have any
questions or concerns, please feel free to let me know. I am more than
happy to be of assistance.

Have a nice day!

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
 
Hello Ji,

1. I use Access 2000. However, I have saved the database also in Access 2007
and tried it. This produces no change.
2. I have sent you the querry SQL as a mail to: (e-mail address removed).
3. Tables structures have not been changed.
4. The database is commercial and confidential so unfortunately I cannot
send it to you although I
understand that taht would be advantageous.

I have made a loop that read the number of rows in the returned read. This
is the same 24005. Access shows that the number of rows in the querry is
43031.
I have also copied the SQL statement in the Access querry and used that as
the CommandText to the reader. This produces no change.

Best regards,
Tom

"Ji Zhou [MSFT]" said:
Hello TompIfe,

Thanks for using Microsoft Newsgroup Support Service, my name is Ji Zhou
[MSFT] and I will be working on this issue with you. After reading your
post carefully, I do the following test and research on my side:

I have created a simple access database which has a table and a query of
the table in it. There are 40,000 rows in the query. I use the exactly
same
codes you post to get the row count of query. But it returns the correct
count number.

This issue is not a general one and I do not find a similar report before.
To work the issue out, it needs both our sides' efforts. So it is
necessary
for us to collect some information to troubleshoot.

Here are some points we need to clarify at the moment:

1.What is the version of Access and have you applied the newest services
pack of Office products. I test on Access 2003 SP3 and Access 2007 SP1,
and
the row count always returns correctly.

2.How is the query expws3 created? Is it generated from several tables and
some complicated relationships? If the expws3's creating is not supposed
to
be discussed in public, please feel free to send me emails about this
information to (e-mail address removed). After getting the info of expws3, I
will try again to reproduce the symptom according to the definition of the
query.

3.After the expw3 is created, have we modified any based table's
structure?
I ask this question because a similar issue in SQL Server was reported.
That issue resulted from the DataView's Schema was not updated after its
based table's schema was modified.

4.If you can provide the reproducible Access database and sent it to me,
that will be helpful for us to have a clearer picture of the issue.

I know there are many questions asked in a time, but they are needed to
narrow down the problem. Thanks for your understanding on this.

Also, here are some suggestions you can try on your side:

1.Make sure the Access file is saved before we use the code to retrieve
data from Access database. The retrieved data will not be updated one
unless we save the Access database file.

2.Execute the sql command "Select * from expws3" with test.ExecuteReader()
and use a loop to find how many rows exist in the returned reader. Codes
look like:
OleDbCommand test = con.CreateCommand();
test.CommandText = "Select * from expws3";
con.Open();

int count = 0;
OleDbDataReader reader = test.ExecuteReader();
while (reader.Read())
{
count++;
}
Debug.Print(count.ToString());

con.Close();

3. Duplicate the current db's schema to a new access db. Input a small
number of rows into it for test, and see whether the query works correctly
when the row count is small.

Best regards,
Ji Zhou ([email protected], remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
(e-mail address removed).

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/en-us/subscriptions/aa948868.aspx#notifications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://support.microsoft.com/select/default.aspx?target=assistance&ln=en-us.
==================================================
This posting is provided "AS IS" with no warranties, and confers no
rights.
 
Yes. It produces the same count as the Reader in ADO (24005 in stead of
43301).

Miha Markic said:
Did you try the same select from within Access?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

TompIfe said:
Hi,
I have an Access database with a querry containing about 40,000 rows.
Using:

OleDbCommand test = conn.CreateCommand();
test.CommandText=

"SELECT COUNT(*) FROM expws3";

conn.Open();

int antall = (int)test.ExecuteScalar();

only 20,000 rows are returned. 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
 
Correction. Used in Access the select produces the correct number of rows.

TompIfe said:
Yes. It produces the same count as the Reader in ADO (24005 in stead of
43301).

Miha Markic said:
Did you try the same select from within Access?

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

TompIfe said:
Hi,
I have an Access database with a querry containing about 40,000 rows.
Using:

OleDbCommand test = conn.CreateCommand();
test.CommandText=

"SELECT COUNT(*) FROM expws3";

conn.Open();

int antall = (int)test.ExecuteScalar();

only 20,000 rows are returned. 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
 
Back
Top