Save new row to the database, any simple sample?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cat

    #1

    Save new row to the database, any simple sample?

    Hi.
    What I am trying to do is very simple, but it somehow didn't work. I
    had created a table in a .MDB file, That table had 5 fields and one of
    which was the primary key. I added a DataGridView and set the binding
    source to that table. Visual Studio generated bunch of adapter
    classes.

    I didn't want to let users directly add rows so I disabled inserting
    rows in the DataGridView, and tried to add a new row programatically .
    I successfully added a new row on the DataGridView, but it wasn't
    persistant. I called the adpaters Update() method but it always
    returned 0. I really tried many things but none of them worked.

    Please let me know any simple example that adds a new row to a
    DataGridView and save the new row to the .MDB file as well so that the
    changes to be persistant.

    Thank you.

Working...