我試圖將數據添加到一個MS Access數據庫,運行沒有錯誤,但該數據庫不被修改。我錯了還是我忘了什麼?MS Access數據庫運行沒有錯誤,但數據庫沒有被修改
//using System.Data.OleDb;
private void button2_Click(object sender, EventArgs e)
{
string conStr = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Projects\Cinema.accdb;Persist Security Info=False;";
OleDbConnection con = new OleDbConnection(conStr);
con.Open();
OleDbCommand cmd = new OleDbCommand("insert into seats(number)" + "Values(1)", con);
con.Close();
}
嗯...在一分鐘內三個答案^^ – 2012-07-17 09:01:49