I have the following bit of code which crashes with error "Column 'id'
cannot be null" when run with the new connector, but the same thing
works with the ByteFX . Is this a bug, or am I not calling parameters
correctly?
Regards
David
using System;
using MySql.Data.MySqlClient;
namespace mytest1
{
/// <summary>
/// Summary description for Class1.
/// </summary>
class Class1
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main(string[] args)
{
// Set up a mysql connection using MySql-AB
string connstr = "Persist Security
Info=False;database=pnet;server=benden;user id=dbuser;Password=p1nestap";
MySqlConnection conn = new MySqlConnection(connstr);
MySqlCommand cmd = new MySqlCommand();
conn.ConnectionString = connstr;
conn.Open();
string cmdstr = "insert into rawreviews (id, review)
values(@id, @review)";
cmd.Connection = conn;
cmd.CommandText = cmdstr;
cmd.Parameters.Add("id", 4);
cmd.Parameters.Add("review", "Fourth Review");
cmd.ExecuteNonQuery();
conn.Close();
}
}
}