为什么将更改保存到数据库失败?
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); }