我在操作 Access 2007 数据库时遇到了困难。我的代码是这样的:
using (OleDbConnection connection = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\User\\db.accdb;Jet OLEDB:Database Password=" + password + ";Persist Security Info=False"))
{
connection.Open();
string query = "INSERT INTO Book(Name, Author) VALUES('Hello', 'World')"; ;
OleDbCommand cmd = new OleDbCommand(query, connection);
cmd.ExecuteNonQuery();
connection.Close();
}
为什么我不能将记录写入该数据库的表中?如何查看记录的单元格?