I was trying to make a registration statement with C#. Obviously I couldn't make it. I don't exactly know what the problem is. With that said here is a snippet:
MySqlConnection Connection =
new MySqlConnection("SERVER=localhost;UID=root;");
MySqlCommand Command =
new MySqlCommand("CREATE USER 'testuser'@'localhost'
IDENTIFIED BY 'superpassword';", Connection);
Command.ExecuteNonQuery();
Before executing the command, you need to open the connection
Do not forget to enclose the disposable commands in a Using Statement
EDIT Looking at your code (why don't you put here immediately?) it is clear where is the error
this line
should be
There are three parameters passed to the string format, so the indexes to be used for the placeholders in the string.format are 0, 1 and 2.
You used 3 for the password and this gives the out of range exception