C# MySQL

How to Pass Parameter to MySQL in C#

To connect to MySQL database you can use the System.Data.Odbc namespace in .net

Adding parameters the queries in System.Data.Odbc works different than System.Data.SqlClient. While using a SqlCommand we add parameters in form of @parameter name. Parameter names are directly mapped to their values.




But this is not the case for an OdbcCommand. The parameters in an OdbcCommand are specified by “?” and the sequence of adding parameters is really important unlike to SqlCommand.

 

 

 

Leave a Comment