Hello all,
I'm new to vb.net and I'm having trouble with my adapter.fill statements.
I have two tables in an Access database where the number of records are virtually identical. I have a query that links the two tables and displays the records that are not identical. One of the two tables gets updated automatically by a punch clock and I need this query to show the difference and print it out. When I add the record to the first table; it works but the query isn't refreshed and I end up printing the same record!
Here is my code:
When I run the application, my queryPunchDetails contains all the records that need to be printed. For example if I have 10 records in the query, it
prints the first one then, instead of having 9 left, it adds 9 to the dataset and I end up with 19! If I close and reopen the app. I have the correct number of records which is 9.
Please help or point me to the right tutorial because i've searched everywhere including that guy who has the tutorials in his sig. with no result!
Thanks in advance.
I'm new to vb.net and I'm having trouble with my adapter.fill statements.
I have two tables in an Access database where the number of records are virtually identical. I have a query that links the two tables and displays the records that are not identical. One of the two tables gets updated automatically by a punch clock and I need this query to show the difference and print it out. When I add the record to the first table; it works but the query isn't refreshed and I end up printing the same record!
Here is my code:
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] anyRow [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] DataRow = dsTimeStamp.tblLastPrint.NewRow[/SIZE]
[SIZE=2]anyRow("ANNO") = txtYear.Text[/SIZE]
[SIZE=2]anyRow("EVENTTYPE") = txtEventType.Text[/SIZE]
[SIZE=2]anyRow("FLAGEXPORT") = txtFlagExport.Text[/SIZE]
[SIZE=2]anyRow("GIORNO") = txtDay.Text[/SIZE]
[SIZE=2]anyRow("MESE") = txtMonth.Text[/SIZE]
[SIZE=2]anyRow("MINUTO") = txtMinute.Text[/SIZE]
[SIZE=2]anyRow("ORA") = txtHour.Text[/SIZE]
[SIZE=2]anyRow("PERNO") = txtPerno.Text[/SIZE]
[SIZE=2]anyRow("SECONDO") = txtSecond.Text[/SIZE]
[SIZE=2]anyRow("SOURCE_SYS") = txtSource.Text[/SIZE]
[SIZE=2]anyRow("TERMID") = txtTermID.Text[/SIZE]
[SIZE=2]anyRow("TIMEID_NO") = txtTimeIDNo.Text[/SIZE]
[SIZE=2]dsTimeStamp.tblLastPrint.Rows.Add(anyRow)[/SIZE]
[SIZE=2]OleDbDataAdapter2.Update(dsTimeStamp, "tblLastPrint")[/SIZE]
[SIZE=2]dsTimeStamp.tblLastPrint.AcceptChanges()[/SIZE]
[SIZE=2]TimeStamp(sStamp)[/SIZE]
[SIZE=2]OleDbDataAdapter1.Fill(DataSet11, "qryPunchDetails")[/SIZE]
When I run the application, my queryPunchDetails contains all the records that need to be printed. For example if I have 10 records in the query, it
prints the first one then, instead of having 9 left, it adds 9 to the dataset and I end up with 19! If I close and reopen the app. I have the correct number of records which is 9.
Please help or point me to the right tutorial because i've searched everywhere including that guy who has the tutorials in his sig. with no result!
Thanks in advance.