MISSING ACCESS RECORDS
by TompIfe » Tue, 02 Sep 2008 22:37:12 GMT
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
Re: MISSING ACCESS RECORDS
by Miha Markic » Wed, 03 Sep 2008 15:10:46 GMT
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://www.**--****.com/
RE: MISSING ACCESS RECORDS
by v-jzho » Wed, 03 Sep 2008 16:08:47 GMT
ello 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 XXXX@XXXXX.COM . 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 ( XXXX@XXXXX.COM , 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:
XXXX@XXXXX.COM .
==================================================
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 Mic
RE: MISSING ACCESS RECORDS
by v-jzho » Fri, 05 Sep 2008 17:27:48 GMT
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 ( XXXX@XXXXX.COM , 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:
XXXX@XXXXX.COM .
This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================
Re: MISSING ACCESS RECORDS
by TompIfe » Fri, 05 Sep 2008 20:25:29 GMT
ello 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: XXXX@XXXXX.COM .
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]"" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
Re: MISSING ACCESS RECORDS
by TompIfe » Fri, 05 Sep 2008 20:27:48 GMT
Yes. It produces the same count as the Reader in ADO (24005 in stead of
43301).
Similar Threads:
1.MISSING ACCESS RECORDS - CORRECTION
2.Missing first record
Using asp.net and .net framework 2 and SQL server 2000
I am using simple SELECT statement in SP to retrieve data and then bind to a
datagrid but fail to pick up the first record in the dataset:
invConn = New
SqlConnection(ConfigurationManager.ConnectionStrings("Connectstring").ConnectionString)
invConn.Open()
invComm = New SqlCommand(zStrg, invConn)
invComm.CommandType = Data.CommandType.StoredProcedure
invComm.Parameters.AddWithValue("@ClCode", strClCode)
iP = invComm.ExecuteReader
iP.Read()
dgPInv.DataSource = iP
dgPInv.DataBind()
iP.Close()
invConn.Close()
The SP is pulling back the full dataset but code above misses first rec.
with thanks
3.Add missing records into datatable..
Mahesha,
I'd approach this via brute force. Load the two tables, search the child
table for the missing records and create them, then set the relation.
This is not a good idea to do client side if the two tables are large. In
that case, load a table into SQL with the dates, add the child records, then
extract what you need. These tables can be psuedo temp tables if needed.
"Mahesha" < XXXX@XXXXX.COM > wrote in message
news: XXXX@XXXXX.COM ...
> Hello,
>
> I want to add a data relation between two tables based on a date.
> I have a datearray table in a SQL server database
> which contains a Date column.
> I query sql server to get distinct dates from this table based on a
> daterange(say 5 years) and populate a datatable.
> I then query a sybase data source which contains Date and datavalue
> fields to get the data for the same 5 years date range.
> Now I have two datatables in a data set one with Date data(master
> table) and another with date,datavalue data (detail table).
> I want to add datarelation between these two tables on the date
> field.This is going to fail because there are some date records in my
> master table which do not have child records in the detail table.
> I want to add these missing date records into my child datatable with
> null datavalues and then add the datarelation. I want to know which is
> the easiest way to accomplish this.?
>
> Thanks
> -Mahesha
4.text missing from sql record after return
I have a web form with a multiline textbox. The string value entered into
the textbox is inserted into a field in the sql server. If a return is
pressed in the web form textbox to start a new line, the text following the
return appears in the sql insert statement when printed before inserting,
but is missing from the sql stored text value. I
check the sql stored value by running a select statement after the insert.
If no return is pressed in the web form textbox then the entire value is
inserted into the sql cell. Any ideas? I am running MSDE 2000 and VB.NET.
Thanks for your help,
John
5.Reading an Excel file - missing first record....
Hi,
I am using the following code to read the data from an Excel spreadsheet. It
runs basically OK but it skips the first row of the spreadsheet. Does anyone
know how to either read the first line or (*hack warning*) insert a blank
record in the first line of the worksheet....?
Dim cnExcel As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data
Source = MyFile.xls;Extended Properties=Excel 8.0;")
cnExcel.Open()
lookup = cnExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)
Dim cmdExcel As New OleDbCommand("SELECT * FROM [" &
lookup.Rows(0)("TABLE_NAME") & "]", cnExcel)
Dim dr As OleDbDataReader
dr = cmdExcel.ExecuteReader
If dr.Read Then
response.write(dr(0))
end if
dr.Close()
cnExcel.Close()
Thanks in advance,
Stu
6. Missing Record in Crystal Report
7. Newbie Missing Something with Access DB Update Using VB .NET
8. MS Access provider missing