为什么我有这个错误?错误消息是:INSERT INTO 语句中的语法错误。
我想在我的数据库中添加一条记录,但它不起作用。问题出在哪里?
代码是:
using (OleDbConnection connection = new OleDbConnection(connectionString))
{
OleDbDataAdapter DbDataAdabter = new OleDbDataAdapter();
DbDataAdabter.SelectCommand = new OleDbCommand("SELECT * FROM [Phone-Book]", connection);
OleDbCommandBuilder cb = new OleDbCommandBuilder(DbDataAdabter);
connection.Open();
DataRow dataRow = myDataset.Tables["salam"].NewRow();
dataRow[1] = textBox2.Text;
dataRow[2] = textBox3.Text;
dataRow[3] = textBox4.Text;
dataRow[4] = textBox5.Text;
dataRow.EndEdit();
myDataset.Tables["salam"].Rows.Add(dataRow);
DbDataAdabter.Update(myDataset , "salam");
connection.Close();
connection.Dispose();
}
}