problems with my database connection(Update)

johmolan

Well-known member
Joined
Oct 11, 2008
Messages
129
Programming Experience
Beginner
I load an access Database into several grids in my form.
I use query into the datagrid and not the basic table.

then I do some work and save it all in an xls-file.

Then I for test open and edit the xls file in another program.

I then load it back into the dataset.

But when I know want to save theese changes into my database.
it does not work.

I need to save the data in the datagrid into the database basic table.

I will try to show you.

My fill sentence is like this:
Me.SpørringSammendragTableAdapter.Fill(Me.Database4DataSet1.SpørringSammendrag)

Then I try to update the basic table like his:
Me.SammendragTableAdapter.Update(Me.Database4DataSet1.Sammendrag)

But I guess since the has been noen actual change in the database there is nothing to update.

How can I update the data that is present in the datagrd, back to the database table?
 
You need to go through the Me.Database4DataSet1.Sammendrag table and anything you want sending to the database, you need to call SetAdded, SetModified or SetDeleted on that row, before you call update..

If, however, youre using your app to download info from a db, save it to excel, let the user edit it and then re-load it into the database, you must either:
Write a comparison routine to work out what the user changed in excel, using a before-file and an after-file or
Delete everything out of the database, and upload the entire contents of the excel file
Dont export to excel at all; have the user edit the data in a datagrid
 
Back
Top