【发布时间】:2016-07-12 20:17:51
【问题描述】:
我在查询中收到“INSERT INTO 语法错误”,我不知道为什么。 (与 Access 的连接在另一个类中)。
public void InsertOrder(Order Item) // add new order
{
string cmdStr = "INSERT INTO [Order] (CostumerID,ProID,ProName,ProPrice,Comments,Discount,Color,Size,Quantity,OrdertDate) VALUES (@costumerID,@proID,@proName,@proPrice,@comments,@discount,@proColor,@proSize,@quantity,@orderDate)";
using (OleDbCommand command = new OleDbCommand(cmdStr))
{
command.Parameters.AddWithValue("@costumerID", Item.CostumerID);
command.Parameters.AddWithValue("@proID", Item.ProId);
command.Parameters.AddWithValue("@proName", Item.ProName);
command.Parameters.AddWithValue("@proPrice", Item.ProPrice);
command.Parameters.AddWithValue("@comments", Item.Comments);
command.Parameters.AddWithValue("@discount", Item.Discount);
command.Parameters.AddWithValue("@proColor", Item.ProColor);
command.Parameters.AddWithValue("@proSize", Item.ProSize);
command.Parameters.AddWithValue("@quantity", Item.Quantity);
command.Parameters.AddWithValue("@orderDate", Item.OrderDate);
base.ExecuteSimpleQuery(command);
}
}
有什么帮助吗? 谢谢!
【问题讨论】: