When I try to insert a string value using mdmysql.Parameters.AddWithValue it generates an input format string exception. Following is the code which produces the error:
cmdmysql.Parameters.AddWithValue("@p_mode", MySqlDbType.VarChar).Value = "ccc";
I tried with varchar, string, text but nothing is working. Also if I put null in place of “ccc” then the record gets inserted into the table. The variable type for p_mode in table is varchar. What is the reason for this exception?
The
AddWithValuefunction takes only two inputs, 1. The parametername and 2. the valueIf you want to use the definition of types you must use the normal
Addfunction:I would guess that the exception comes from your second input where you parse an
MySqlDbTypeto the function and not the acutal value you want the returned mysqlparameter to have.