problem with update statement

  • Thread starter Thread starter Shweta
  • Start date Start date
S

Shweta

Hi,

I am new to visual studio.net, hence the stupid questions!
1. In a form,i created 2-3 text boxes, and created a databinding
between them and the corresponding tables in the database (sql). And
generated an 'update' statement using the query builder while creating
the oledbdataadapter. Now whenever I put in a name and the 'search'
button returns matched results from the dataase (like i put int he
last name and the person's address, phone number etc comes ). Now if I
make any changes in the information and try to save that by hitting
the 'update' button, it does not save the changes, the same old record
comes up! Also I do not know how to use the 'add' statement. I want to
add a new name, hsi address etc directly from the user interface to
the database. Below is the code I used for the update statement:
private void btnupdate_Click(object sender, System.EventArgs e)
{
oleDbDataAdapter1.Update(custinfo1);
}

Please tell me whatr I am doing wrong! Also I created a mock databse,
and just declared the 'name' column as the 'primary key'.

Any help is appreciated!.thanks a bunch
Shweta
 
Hi Shweta,

You have to invoke BindingManagerBase.EndCurrentEdit for current record
prior to save changes.
Either that or move BindingManagerBase.Position.
 
Back
Top