Data adapter, dataset, datat table, data row...

sethindeed

Well-known member
Joined
Dec 31, 1969
Messages
118
Location
Montreal Canada
OK,
I am at a point where I can easily read the database with the datareader object but I am still unable to update, add or delete records.
I havent found any simple sample code on this forum and I understand that once you understood the complex strucutre, you may not want to give it away just like that.
At this point, I have been able to fill a dataadapter with a dataset. BUt it seems that it is not enough...
Do I have to fill a data table with the dataset, then fill the datarow and datacolumn with the datatable.
Why 16 lines of code for what used to take 3 ?
Is it the price to pay for better software ?
Jokes apart, once my ole dataadapter ( I am using Access ) is filled, what is the next step ?
 
There are a number of tutorials on line but... if I were you Id just use the DataAdapter wizard to create all the command objects needed, then just look at the generated code to learn from it. Youll instantly see opportunities to improve it.

btw, my guess is that you have been able to fill a dataset with a dataadapter, not the other way around:)
 
Now, I reached the point where I have to update my data adapter with modified data and I am getting the following error message :

Update requires a valid UpdateCommand when passed DataRow collection with modified rows...

Almost there...

my code is oleAdapt.Update(ds)
 
You can use the CommandBuilder class to create the commands you need to update, add and delete from the database, then set the *Command properties to the specific command. After thats done you can update your database.
 
Back
Top