Question

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.

Was it helpful?

Solution

INSET should be INSERT.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top