When I try inserting binary data into a blob column of a MySQL database using MySql.data.dll , the following exception is thrown- error in syntax near '\b\0\0\b\0\0��\0\0'.
Following is my code snippet:
byte[] arrayData = memoryStreamFromFile.ToArray( );
cmd.CommandText = "insert into `attachmentdata` (`data`,`blobid` ) values (?data,?blobid)";
MySqlParameter msp = new MySqlParameter( "data", MySqlDbType.Blob );
msp.Value = arrayData;
cmd.Parameters.Add( msp );
MySqlParameter msp1 = new MySqlParameter( "blobid", MySqlDbType.VarChar );
msp1.Value = "uid1263";
cmd.Parameters.Add( msp1 );
int ret = cmd.ExecuteNonQuery( );
The above code works when NO_BACKSLASH_ESCAPE is disabled on the server. Is there any mechanism to avoid conversion of binary data to character representation when SQL_NO_BACKSLASHES mode is used. I am using the latest version of MySql server( 5.1.48)
Thanks in advance,
Bharath.