When MySQL is referenced using the Parameter-based code, the following message is always displayed: "Column bitsCN.com
When MySQL is referenced using the Parameter-based code, the following message is always displayed: "Column 'column name' cannot be null ".
MySQL uses the Parameter-based code and always prompts: "Column 'column name' cannot be null"
Solution 1: Add an oldsyntax = true to the connection string.
For example:
Server = 127.0.0.1; user id = root; password =; database = itemdb; oldsyntax = true
Solution 2: replace @?
For example:
StringBuilder strSql = new StringBuilder (); strSql. append ("insert into test ("); strSql. append ("name)"); strSql. append ("values ("); strSql. append ("? Name) "); MySqlParameter [] parameters = {new MySqlParameter ("? Name ", MySqlDbType. VarChar, 45)}; parameters [0]. Value = model. name; DbHelperMySQL. ExecuteSql (strSql. ToString (), parameters );
BitsCN.com