954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

oleDbCommand - Update

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.

die nadel
Newbie Poster
4 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

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.

mike.mclennan
Light Poster
45 posts since May 2007
Reputation Points: 39
Solved Threads: 0
 

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.

die nadel
Newbie Poster
4 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

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.

mike.mclennan
Light Poster
45 posts since May 2007
Reputation Points: 39
Solved Threads: 0
 

Thanks man

die nadel
Newbie Poster
4 posts since May 2007
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You