第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

為什么將更改保存到數(shù)據庫失?。?/h1>

為什么將更改保存到數(shù)據庫失敗?

青春有我 2019-06-03 10:19:16
為什么將更改保存到數(shù)據庫失?。肯旅媸强刂婆_應用程序中的C#代碼。每當我調試應用程序并運行query1(它向數(shù)據庫中插入一個新值),然后運行query2(它顯示數(shù)據庫中的所有條目),我就可以清楚地看到我插入的新條目。但是,當我關閉應用程序并檢查數(shù)據庫中的表(在VisualStudio中)時,它就消失了。我不知道它為什么不儲蓄。using System;using System.Collections.Generic;using System.Data.Entity;using System.Linq;using System.Text;using System.Threading.Tasks; using System.Data.SqlServerCe;using System.Data;namespace ConsoleApplication1{     class Program     {         static void Main(string[] args)         {             try             {                 string fileName = "FlowerShop.sdf";                 string fileLocation = "|DataDirectory|\\";                 DatabaseAccess dbAccess = new DatabaseAccess();                 dbAccess.Connect(fileName, fileLocation);                 Console.WriteLine("Connected to the following database:\n"+fileLocation + fileName+"\n");                 string query = "Insert into Products(Name, UnitPrice, UnitsInStock) values('NewItem', 500, 90)";                 string res = dbAccess.ExecuteQuery(query);                 Console.WriteLine(res);                 string query2 = "Select * from Products";                 string res2 = dbAccess.QueryData(query2);                 Console.WriteLine(res2);                 Console.ReadLine();             }             catch (Exception e)             {                 Console.WriteLine(e);                 Console.ReadLine();             }         }     }     class DatabaseAccess     {         private SqlCeConnection _connection;         public void Connect(string fileName, string fileLocation)         {             Connect(@"Data Source=" + fileLocation + fileName);         }         public void Connect(string connectionString)         {             _connection = new SqlCeConnection(connectionString);         }編輯:忘記提到我正在使用SQLServerCompactEdition 4和VS 2012 Express。
查看完整描述

2 回答

  • 2 回答
  • 0 關注
  • 783 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號