Okay, here's my progress, after adding a Binary(16) to my employees table and hand tweaking the generated code such that it should have worked, only I receive the message "Data too long for column 'TheGuid' at row 1" and no matter what I tried still the same message. So I tried some stuff with the raw MySQL provider.
Here is the raw provider code:
Code:
MySqlConnectionStringBuilder csb = new MySqlConnectionStringBuilder();
csb.Database = "test";
csb.UserID = "root";
csb.Password = "yada";
csb.Server = "localhost";
csb.Port = 3306;
MySqlConnection conn = new MySqlConnection(csb.ToString());
conn.Open();
MySqlCommand cmd = new MySqlCommand(@"select * from employees", conn);
DataTable dt = new DataTable();
MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
try
{
adapter.Fill(dt);
MySqlCommandBuilder bb = new MySql.Data.MySqlClient.MySqlCommandBuilder(adapter);
MySqlCommand iCmd = bb.GetInsertCommand();
// Give it a guid value
dt.Rows[0]["TheGuid"] = Guid.NewGuid();
adapter.InsertCommand = iCmd;
adapter.Update(dt);
}
catch (Exception ex)
{
System.Console.WriteLine(ex.Message);
}
conn.Close();
Guess what, I still received the same error message. I check the parameter for my Guid column to in the generated Command received back from the CommandBuilder which is what I really wanted to see, ie, what were the settings. To my suprise the raw MySQL provider code will not work either. At this point I'm not sure MySQL truly supports the guid datatype. The code above normally works on all providers.
PS: I emailed Reggie through his blog and alerted him to this thread.
EntitySpaces |
Twitter |
BLOG | Please honor our Software License