TableAdapter.Update not working

Posted by Wesley on Stack Overflow See other posts from Stack Overflow or by Wesley
Published on 2010-03-22T23:13:20Z Indexed on 2010/03/22 23:41 UTC
Read the original article Hit count: 375

Filed under:
|
|
|

Here is my function:

    private void btnSave_Click(object sender, EventArgs e)
    {
        wO_FlangeMillBundlesTableAdapter.Update(invClerkDataDataSet.WO_FlangeMillBundles);
        wO_HeadMillBundlesTableAdapter.Update(invClerkDataDataSet.WO_HeadMillBundles);
        wO_WebMillBundlesTableAdapter.Update(invClerkDataDataSet.WO_WebMillBundles);
        int rowsaffected = wO_MillTableAdapter.Update(invClerkDataDataSet.WO_Mill);

        MessageBox.Show(invClerkDataDataSet.WO_Mill.Rows[0]["GasReading"].ToString());
        MessageBox.Show(rowsaffected.ToString());
    }

You can see the fourth update in the function uses the same functionality as the rest, I just have some debugging stuff added. The first three tables are bound to DataGridViews and work fine. The fourth table has it's members bound to various text boxes.

When I change the value in the text box bound to the GasReading column and click save the first MessageBox does in fact show the new value, so it's making it into the dataset correctly. However, the rowsaffected is always showing 0 and the value in the actual database is not being updated.

Can anyone see my problem? I understand that the problem must be elsewhere in my code since the four update methods are the same, but I just don't know where to start.

© Stack Overflow or respective owner

Related posts about c#

Related posts about sql