I have a tinyblob column that I want to insert binary data into it( a guid)
I create a MySqlCommand using parameter is follow
INSERT INTO MY_TABLE (IDCol) Values (CAST(0xCE2A0AA8D33211D79C4800A0CC40804D AS BINARY))
but when I look in the table, the data is just insert as text
0xCE2A0AA8D33211D79C4800A0CC40804D
Anyone know how to make it insert as binary?
Thanks.
CAST to binary not working
You have to use parameters.
Code: Select all
MySqlCommand command = new MySqlCommand("insert into my_table(f_tinyblob) values (:blob)", connection);
byte [] data;
...
command.Parameters.Add("blob", data);
command.ExecuteNonQuery();