我正在尝试使用已存在的值(在同一行中)更新我的代码,但出现以下错误。
这是代码:
string connectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Projects_2012\\Project_Noam\\Access\\myProject.accdb";
OleDbConnection myConnection = new OleDbConnection(connectionString);
string myInsertQuery = (String.Format("UPDATE tblUsers SET usersID='{0}', usersFirstName='{1}', " +
" usersLastName='{2}',usersPassword='{3}', usersAdress='{4}', usersMail ='{5}' " +
" WHERE usersID='{6}'", idn, firstName.Text, lastName.Text, password.Text, adress.Text
, mail.Text, idn));
OleDbCommand myCommand = new OleDbCommand(myInsertQuery);
myCommand.Connection = myConnection;
myConnection.Open();
myCommand.ExecuteNonQuery();
myCommand.Connection.Close();
这是错误:
System.Data.OleDb.OleDbException crossed a native / managed boundary
Message = mismatch in criteria expression
Source = Microsoft Office Access Database Engine
ErrorCode = -2147217913
我数据库中的参数定义如下:“usersID=number”,其余为文本。