none
Saving Data to SQL DataBase from C# Application RRS feed

  • Question

  • Hi All,

    I have the following problem, I have a database added to my project, it's SQL Server, when I run my code and trying to save to the Database file, I found that there's no saved data at all;

    My procedure in doing this is the following:

    1. Typed Data Set is generated when I added the Database file to my project.
    2. I created a row for the required table:

        3. After filling the fields I added this row to the table by:

    this.

     

     

     

     

    FatawaDataSet TestDs = (FatawaDataSet)this.fatawaDataSet1.GetChanges(); this.messageTableAdapter.Update(TestDs); this.fatawaDataSet1.Merge(TestDs, true, MissingSchemaAction.Add); this.fatawaDataSet1.AcceptChanges();

     But as I told you, I didn't get any saved data in the DataBase

    I'm waiting your answer ASAP.

    Thank you very much.

     

     

     

    .fatawaDataSet1.Message.Rows.Add(drMsg);

    4. I got the changes from the original DataSet and commit these changes by the following code:

    drMsg = this.fatawaDataSet1.Message.NewMessageRow();
    Tuesday, April 14, 2009 5:02 AM

All replies

  • How do you check that changes are saved into database? If you work with the datyabase as a file I believe Visual Studio makes a copy of the database in bin folder each time you start your application, so make sure you check proper copy of the database.
    Val Mazur (MVP) http://www.xporttools.net
    Tuesday, April 14, 2009 10:00 AM
    Moderator