1 Replies - 1420 Views - Last Post: 18 September 2012 - 07:22 PM Rate Topic: -----

#1 Mallbrig  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 9
  • Joined: 16-April 10

C# Update SQL Database wont save after program close

Posted 18 September 2012 - 06:44 PM

Hello, I am converting a program from using comma delimited files to a compact database in 2010 Visual C#. I am a complete newbie in the Database arena but with the help of some of the examples on here and other sites I have gotten a basic start. The examples I found on some sites pointed me into setting up a dataset binding and updating the tables. This works with loading the files into my form but I am having trouble getting it back and staying saved. Below is my code so far. The form text will update the datagridview but after I close the program it will only show the previous data before I updated it. I know I am missing something. Any help is greatly appreciated.


if (contactedtype == "update")
                    DataRow[] customerRow =
                    fabCatDBDataSet.Tables["contactlist"].Select("contactID = '" + contactedcontactID + "'");
                    //put textboxes to table
                    customerRow[0]["title"] = contactedtitle;
                    customerRow[0]["firstname"] = contactedfirst;
                    customerRow[0]["lastname"] = contactedlast;
                    customerRow[0]["jobtitle"] = contactedjob;
                    customerRow[0]["phone"] = contactedtele;
                    customerRow[0]["fax"] = contactedfax;
                    customerRow[0]["cell"] = contactedcell;
                    customerRow[0]["email"] = contactedemail;
                    customerRow[0]["notes"] = contactednotes;
                    customerRow[0]["contactID"] = contactedcontactID;
                    customerRow[0]["clientlistID"] = contactedclientID;
                    //update and save

Is This A Good Question/Topic? 0
  • +

Replies To: C# Update SQL Database wont save after program close

#2 Momerath  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1020
  • View blog
  • Posts: 2,463
  • Joined: 04-October 09

Re: C# Update SQL Database wont save after program close

Posted 18 September 2012 - 07:22 PM

Are you running in debug mode? Debug mode creates a copy of your database for you to work with, which then gets erased when your program ends.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1