我的c#应用程序有问题,它使用的是MYSQL数据库,没有问题!但是当我将数据库更改为MS访问时出现此问题: select语句包含拼写错误或缺失的保留字或参数名称,或者标点符号不正确。
这是我的代码:
OleDbCommand cmd = new OleDbCommand("SELECT action.info, relation.id AS action FROM relation LEFT OUTER JOIN conditions ON relation.conditions_id = conditions.id LEFT OUTER JOIN situation ON relation.situation_id = situation.id LEFT OUTER JOIN car_type ON relation.car_id = car_type.id LEFT OUTER JOIN action ON relation.action_id = action.id LEFT OUTER JOIN signal AS signaal1 ON relation.signal_id = signaal1.id where car_type.info=@car_type" + string2 + " ORDER BY conditions.id ASC", objConn);
cmd.Parameters.AddWithValue("@car_type", radButton1.Text);
OleDbDataReader dataReader = cmd.ExecuteReader();
最后一行执行时出现错误..! “OleDbDataReader dataReader = cmd.ExecuteReader();”
------------------------------------- EDITED 我通过在表名中添加“z”来更改表名,现在又出现了另一条消息:
答案 0 :(得分:0)
Thanx @Grant_Winney,我改变了动作和关系,错误消失了:D但是另一个出现了:s(我问了另一个问题)