Fatal error encountered during command execution with a mySQL INSERT

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-03-18T04:52:41Z Indexed on 2010/03/18 5:01 UTC
Read the original article Hit count: 926

Filed under:
|

I am trying to execute a INSERT statement on a mySQL DB in C#:

MySqlConnection connection = new MySqlConnection("SERVER=" + _dbConnection + ";" +
   "DATABASE=" + _dbName + ";" +
   "PORT=" + _dbPort + ";" +
   "UID=" + _dbUsername + ";" +
   "PASSWORD=" + _dbPassword + ";");
MySqlDataAdapter adapter;
DataSet dataset = new DataSet();
command = new MySqlCommand();
command.Connection = connection;
command.CommandText = "INSERT INTO plugins (pluginName, enabled) VALUES (@plugin,@enabled)";
command.Parameters.AddWithValue("@name", "pluginName");
command.Parameters.AddWithValue("@enabled", false);
adapter = new MySqlDataAdapter(command);
adapter.Fill(dataset);

The plugin table consists of two columns: pluginName(varchar(50)) and enabled(boolean).

This fails with the error: mysql Fatal error encountered during command execution. Any ideas on why this would fail?

© Stack Overflow or respective owner

Related posts about mysql

Related posts about c#