2

我正在执行记录更新操作。我的更新操作正常,但数据库没有更新值。下面是更新代码。

        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. 进行更改后,我可以在 UI 上看到更新的值
  2. 关闭应用程序后,再次重新打开,我可以在 UI 上看到更新的值
  3. 关闭 Visual Studio,重新打开应用程序并再次运行它。
  4. 我没有看到数据库的变化。

我错过了什么吗???

4

1 回答 1

1

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,,,

于 2012-09-26T12:22:34.310 回答