I wanted to create a new database using the MySql.Data.MySqlClient with prepared statements. Unfortunately it shows me an error message "You have an error with your SQL syntax". Using "test" for the iv_name import value of the method.
When executing "CREATE DATABASE IF NOT EXISTS test;" directly in mysql server console, it works without any problems. When adding "'" to left and right of the @dbname a database will be created called @dbname in my mysql server.
public void CreateDatabase(string iv_name)
{
MySqlCommand lo_cmd = new MySqlCommand("CREATE DATABASE IF NOT EXISTS @dbname;", this._conn);
lo_cmd.Prepare();
lo_cmd.Parameters.AddWithValue("@dbname", iv_name);
lo_cmd.ExecuteNonQuery();
}
Here you can find a screen shot from the debuggin process
