PROBLEM WITH UPDATE IN VB.NET

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am trying to update an Access 2000 database using this command for my "Update" button in my project:

daMembers.Update(DsMembers1, "Members")

But, I get this error message when I click on the Update button after making some changes in the DataGrid:

"An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll"

Taking advice from other programmers, I wrote this line of code to try to fix it:

Me.BindingContext(DsMembers1, "Members").EndCurrentEdit()

It hasn't worked. What should I do?

Regards,

Kenneth Clive
 
Make sure you add a Try/Catch block to your code to make sure you see what
the real exceptions are before just shooting ducks in the dark.


--
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
__________________________________

I am trying to update an Access 2000 database using this command for my "Update" button in my project:

daMembers.Update(DsMembers1, "Members")

But, I get this error message when I click on the Update button after
making some changes in the DataGrid:
 
Hi,

Your adapter daMember is probably wrongly configured.
As Bill said, you should tell us what the exception really says (look for
inner exception).

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

I am trying to update an Access 2000 database using this command for my "Update" button in my project:

daMembers.Update(DsMembers1, "Members")

But, I get this error message when I click on the Update button after
making some changes in the DataGrid:
 
Well, I tried that and it caught what the error really was:

System.Data.OleDb.OleDbException: Syntax error in update statement.
at System.Data.Common.DbDataAdapter.Update(DataRow[] dataRows.DataTableMapping tableMapping)
at System.Data.Common.DbDataAdapter.Update(DataSet dataSet, String srcTable)
at MyData.frmMain.Update.update_data in C:\Documents and Settings\Kenneth\My Documents\mydatabase.mdb

I think I'll try the first update syntax in the message: OleDbDataAdapter1.Update(dataRow.tablemapping).

Regards,

Kenneth Clive.
 
Back
Top