开发者

Odbc INSERT not working

Hey, im trying to get an INSERT command to work, but I keep getting the following error.

Error: System.Data.Odbc.OdbcException: ERROR [42000] [MySQL][ODBC 5.1 Driver][mysqld-5.0.90-community]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 'INSET INTO tbl_SoldierStats (SoldierName) VALUES ('Zaeed')' at line 1 at System.Data.Odbc.OdbcConnection.HandleError(OdbcHandle hrHandle, RetCode retcode) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader, Object[] methodArguments, SQL_API odbcApiMethod) at System.Data.Odbc.OdbcCommand.ExecuteReaderObject(CommandBehavior behavior, String method, Boolean needReader) at System.Data.Odbc.OdbcCommand.ExecuteNonQuery() at PRoConEvents.CAussieUnderdogsStatStreamer.StartStreaming()

string insertSQL = "INSET INTO tbl_SoldierStats (SoldierName) VALUES (?)";
                    foreach (CPlayer Soldier in NewPlayers)
                    {

                        using (OdbcCommand OdbcCom = new OdbcCommand开发者_如何学编程(insertSQL, OdbcCon))
                        {

                            OdbcCom.Parameters.AddWithValue("@pr", Soldier.Name);  

                            OdbcCom.ExecuteNonQuery();

                        }
                        NewPlayers.Remove(Soldier);

It gets to the ExecuteNonQuery and then throws the above error.. I can't see whats wrong with it.


INSET should be INSERT.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜