【发布时间】:2016-07-11 17:50:17
【问题描述】:
请,将数据插入 Access 数据库时出现错误代码。它一直说我的 INSERT INTO 语句中有 sytanx 错误。任何人都可以帮我解决这个问题。 这是代码
try {
OleDbConnection connection = new OleDbConnection(@"Provider = Microsoft.ACE.OLEDB.12.0; Data Source = C:\Users\DELL\Documents\EmployeesData.accdb;
Persist Security Info = false;");
connection.Open();
OleDbCommand cmd = new OleDbCommand("insert into EmployeeInfo (UserName, Password) values('" + UserText.Text + "', '" + PassText.Text + "')", connection);
cmd.ExecuteNonQuery();
MessageBox.Show("Inserted");
}
catch (Exception ex)
{
MessageBox.Show("Failed" + ex.ToString());
}
【问题讨论】:
-
你可以比向 Little Bobby Tables 寻求建议更糟糕......