MySqlCommand Command.Parameters.Add is obsolete

try AddWithValue

command.Parameters.AddWithValue("@mcUserName", mcUserNameNew);
command.Parameters.AddWithValue("@mcUserPass", mcUserPassNew);
command.Parameters.AddWithValue("@twUserName", twUserNameNew);
command.Parameters.AddWithValue("@twUserPass", twUserPassNew);

and don't wrap the placeholders with single quotes.

string SQL = "INSERT INTO `twMCUserDB` (`mc_userName`, `mc_userPass`, `tw_userName`, `tw_userPass`) VALUES (@mcUserName, @mcUserPass, @twUserName, @twUserPass)";

Edit: As Bradley Grainger pointed out, in MySQL is safe to use AddWithValue. I'm keeping my answer if you get here by chance and use Microsoft SQL.


Please read this article, advising you against using AddWithValue:

https://blogs.msmvps.com/jcoehoorn/blog/2014/05/12/can-we-stop-using-addwithvalue-already/

It says basically that AddWithValue could sometimes incorrectly infer the correct type. Use Add instead.


Just edit/remove some code in this part

('@mcUserName', '@mcUserPass', '@twUserName', '@twUserPass')

to

(@mcUserName, @mcUserPass, @twUserName, @twUserPass)

and Add( to AddWithValue(