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

Re: problem with update statement by Miha

Miha
Thu Jan 08 03:52:39 CST 2004

Hi Shweta,

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

--
Miha Markic - RightHand .NET consulting & software development
miha at rthand com
www.rthand.com

"Shweta" <agnihotrishweta@hotmail.com> wrote in message
news:ea7e262a.0401071725.1eff09c1@posting.google.com...
> 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