Dim cb As New OleDb.OleDbCommandBuilder(da)

ds.Tables("me").Rows(inc).Item(2) = txtFirstName.Text
ds.Tables("me").Rows(inc).Item(3) = txtLastName.Text

da.Update(ds, "me")

Im getting a hard time on updating the database, What should I do to update or even add to the database.
The code above is what I use but still it gives me an error.
Please help. Im just new in using VB.net.
Thanks.

Recommended Answers

All 4 Replies

obviously this is an ASP.NET message board if i am not mistaken. But it seem that you are sending the Update Method a string ("me"), if you set your update command as default it should except strings, integers, bool as default values for each item in the table. maybe you should be doing something more like

da.Update(txtFirstName.text, txtLastName.Text)

Anyways when you open the method, opening it would be putting the "(" after the method name, it should display a tool tip with what the method needs sent it. It should look like (string FirstName,string LastName) and you have to match each item with what value you want sent it..... just take a look.

Hope that helps in some way.

Still have error An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll eventhough I follow the tool tip you are referring to.

put a try catch block around it and create a message box to display the incoming errors

MessageBoc.Show(e.Message)

and then run through it with break points. use the F9 key to create a break point and then run through the program with the debugger. The debugger is the most powerful tool in your arsenal. use it as often as you can.

Thanks man

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.