Updating a database using ADO.NET Data Adapter

dpifer

Member
Joined
Jul 21, 2003
Messages
11
Location
San Antonio, TX
Good Evening All,

I just recently have been fooling around with VB.NET and ADO.NET. I am a big fan of writing my own code instead of using wizards to do the work for me and I have not been able to update a database yet. By using the wizards I have been able to do this but have yet to be successful doing it through code using a data adapter. If someone could look at the attached file and see if I am way off course or just a minor glitch in my logic somewhere. I used the SQL Server Northwind database for a sample.

Thanks,
Dave Pifer
 

Attachments

Solution and file included

the problem with your code is that you were using two dataadapters: one for the select statement and another for the insert. you need to have one dataadapter for all the operations (delete, insert, add, update)

Also you needed to correct the insert command and specify the insert values as parameters.

you can see the changes and the comments I left in the code.

Best of luck
 

Attachments

Back
Top