Parameterized SQL-INSERT’s Using OdbcCommand

Here I’d like to give you an idea about inserting data into a table using parameters within an ODBC command. The reason is that I didn’t find a concrete sample at the MSDN yet :( The following code snippet was written C#:

1
2
3
4
OdbcCommand insertCommand = new OdbcCommand("INSERT INTO table VALUES(?,?)", connection);
insertCommand.Parameters.AddWithValue("param1", "Hello");
insertCommand.Parameters.AddWithValue("param2", "World");
insertCommand.ExecuteNonQuery();

0 Responses to “Parameterized SQL-INSERT’s Using OdbcCommand”


  • No Comments

Leave a Reply