Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi,

I'm trying to update my (Access) database with resorting to SQL but it will not work :mad:

 

myDataView.AllowEdit = True
myDataView(iRow).BeginEdit()
myDataView(iRow).Item(1) = True ' Used to be false from database
myDataView(iRow).EndEdit()
myDataView.Table.AcceptChanges()

When checking for modified rows there are none but there's no changes in the database. And on reloading the old values are still present :confused:

 

What's missing?!?

 

Regards

/Kejpa

  • *Experts*
Posted

Read up on AcceptChanges, first. Basically: a DataSet keeps internal flags for each row: original, modified, new, deleted, etc. When you call AcceptChanges it clears all those flags and puts them back to "original". If you're using a DataAdapter then no rows will be marked as needing updates to the database.

 

You didn't show your code for making the actual update (likely a DataAdapter's Update method). The proper way is to use the DataAdapter to do the Update and *then* call AcceptChanges.

 

-ner

"I want to stand as close to the edge as I can without going over. Out on the edge you see all the kinds of things you can't see from the center." - Kurt Vonnegut
Posted
You didn't show your code for making the actual update (likely a DataAdapter's Update method).

That's true!

Cos I don't have any. I now realize that I should.

 

Why is it sooooo complicated with .NET?!?

It used to be strait forward, get a recordset, update the rows, call the update and you're done.

Now you have to have a zillion objects just to get the records and a dozen times more to update.:mad:

 

I'll guess I'll stick to plain SQL, that's simple.

/Kejpa

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...