我在c#中使用MySql.Data作爲mysql連接。在另一個程序工作,但目前我掛在INSERT INTO命令。C#MySql.Data INSERT INTO錯誤
我得到以下錯誤:
An unhandled exception of type 'MySql.Data.MySqlClient.MySqlException' occurred in MySql.Data.dll
Additional information: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'key) VALUES ('PGJWZBPOWTRPUTKY')' at line 1
有了這個代碼:
MySqlCommand Command = Connection.CreateCommand();
MySqlDataReader Reader;
Command.CommandText = "INSERT INTO jt_teamsync (key) VALUES ('" + TeamSyncKey + "')";
Connection.Open();
Reader = Command.ExecuteReader();
Connection.Close();
感謝所有幫助
該錯誤.. key'也是什麼是'一個字段name..if所以爲什麼不''別名'表名'插入jt_teamsync J(j.key)VALUES(''+ TeamSyncKey +'')「;''例如 – MethodMan 2013-04-05 18:04:01