public void log(int materialId,string materialName, string action, string description, string datetime, double amount,string unit)
{
OleDbCommand insertIntoLog = new OleDbCommand();
insertIntoLog.CommandText = "INSERT INTO NCCI_eventslog (materialId,materialName,action,description,date_time,amount,unit) Values (@materialId,@materialName,@action,@description,@date_time,@amount,@unit)";
insertIntoLog.Connection = database;
insertIntoLog.Parameters.AddWithValue("@materialId", materialId);
insertIntoLog.Parameters.AddWithValue("@materialName", materialName);
insertIntoLog.Parameters.AddWithValue("@action", action);
insertIntoLog.Parameters.AddWithValue("@description", description);
insertIntoLog.Parameters.AddWithValue("@date_time", datetime);
insertIntoLog.Parameters.AddWithValue("@amount", amount);
insertIntoLog.Parameters.AddWithValue("@unit", unit);
if (database.State == ConnectionState.Open)
{
database.Close();
}
database.Open();
insertIntoLog.ExecuteScalar();
}
错误是:Insert Statement中的语法错误,我在Access Query SQL中复制了insert语句并且没有错误是什么问题?