user1546784
user1546784

Reputation: 135

SQL Server Database is not updated via C# Code

I am performing record update operation . my update operation is happening fine but database is not updating values . below is update code.

        SupPartEntityVal supplypart = new SupPartEntityVal();

        String sNum = sNumText.Text;
        String sName = sNameText.Text;
        String sStatus = sText.Text;
        String sCity = cText.Text;
        int rowIndex = int.Parse(rIndex.Text);

        ObjectQuery<S> supply = supplypart.S;
        var query =
        from product in supply
        select new { product.SNUM, product.SNAME, product.STATUS, product.CITY };
        S sup = supplypart.S.Single(product => product.SNUM == sNum);
        sup.SNAME = sName; sup.STATUS = short.Parse(sStatus); sup.CITY = sCity;

        this.supplypart.SaveChanges();
  1. After making changes, I can see updated value on UI
  2. After I close an application, reopen again I can see updated value on UI
  3. Close Visual studio, reopen the application and run it again.
  4. I do not see changes in database.

am i missing something???

Upvotes: 2

Views: 262

Answers (1)

Muhammad Azeem
Muhammad Azeem

Reputation: 479

You Can Check Your Record When Saving In Database through Select Query on Command.. And See That is record is Saving? If Yes.. Then Issue is in your Database ... Normally this occurs when we use OLEDB that is Storing Database in project,,,

Upvotes: 1

Related Questions