Save data doesn't work

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

    #1

    Save data doesn't work

    Hello!

    I'm using VS2005.
    I'm looking at ADO.NET and have found some test tutorial solution on
    microsoft MSDN.
    The one that I'm looking at now is called Walkthrough: Saving Data to a
    Database (Single Table)

    I have followed the walkthrought exectly but it doesn't work as expected.

    I have a Data Source with one database table.
    The table is from the northwind database and is called customer.
    This table is set to be in Detail mode meaning I get individuals control for
    the whole table when I drag the table into the windows form.

    In this form there is a diskett meaning that I can save data back to the
    database.

    So I do the following change some data in one of the control and then click
    the diskett symbol meaning I save the data back to the database.
    If I now go to the next record and then go back to the previous record the
    change is there.
    So I manage to change in the dataset but if I then close the application and
    look in the database my changes has not changed anything in the database.

    I can't understand why this doesn't work.


    //Tony


  • TonyJ

    #2
    Re: Save data doesn't work

    Hello!!

    Below is the event handler that is called when I click the diskett save
    icon.
    The text that is printed is Update successful so I don't get any errors but
    as I mentioned no update is done to the
    database.
    private void customersBindin gNavigatorSaveI tem_Click(objec t sender,
    EventArgs e)
    {
    try
    {
    this.Validate() ;
    this.customersB indingSource.En dEdit();
    this.customersT ableAdapter.Upd ate(this.nwindD ataSet.Customer s);
    MessageBox.Show ("Update successful");
    }
    catch (System.Excepti on ex)
    {
    MessageBox.Show ("Update failed");
    }
    }





    "TonyJ" <johansson.ande rsson@telia.com skrev i meddelandet
    news:%23mPqh%23 KFIHA.1164@TK2M SFTNGP02.phx.gb l...
    Hello!
    >
    I'm using VS2005.
    I'm looking at ADO.NET and have found some test tutorial solution on
    microsoft MSDN.
    The one that I'm looking at now is called Walkthrough: Saving Data to a
    Database (Single Table)
    >
    I have followed the walkthrought exectly but it doesn't work as expected.
    >
    I have a Data Source with one database table.
    The table is from the northwind database and is called customer.
    This table is set to be in Detail mode meaning I get individuals control
    for
    the whole table when I drag the table into the windows form.
    >
    In this form there is a diskett meaning that I can save data back to the
    database.
    >
    So I do the following change some data in one of the control and then
    click
    the diskett symbol meaning I save the data back to the database.
    If I now go to the next record and then go back to the previous record the
    change is there.
    So I manage to change in the dataset but if I then close the application
    and
    look in the database my changes has not changed anything in the database.
    >
    I can't understand why this doesn't work.
    >
    >
    //Tony
    >
    >

    Comment

    Working...