SQLDataAdapter.Update problem

D

Dave

We have a simple form that has text boxes bound to a
single table/columns. We get the dataset filled okay and
the data displays okay in the text boxes. However when
we change the data in the text box and hit our button
control to update the data (i.e. SQLDataAdapter.Update
(dsName.tableName)) we get nothing ... no error and no
update.

If we put a datagrid in the form and have the datasource
point to the dataset it works fine ... however our
customer requires a form with text boxes.

Certainly appreciate anyone's help/ideas!
 
I

Igor Dontsov

Hello, Dave.

Try following in your button click event handler:

private void buttonSubmit_Click(object sender, System.EventArgs e)
{
// ensure that current editings are passed to datasource (i.e.,
dataset in our case)
BindingContext[dsName.tableName].EndCurrentEdit();

sqlDataAdapter1.Update(dsName.tableName);
}

This works for me.
 
B

Brian P. Hammer

Make sure you end the current edit first.

BindingContext(DsName, "TableName").EndCurrentEdit()
daName.Update(DsName, "TableName")
 
D

Dave

Brian,
Thanks a bunch! It works ... I'm still a rookie at this
and have been running in circles on this one ... thanks
again!
Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top