This may or may not have been answered before, and
I have googled to death on it and I am not getting any good answers. So
here it is:
I am trying to update some blob data in an MS Access DB.
When I run the following code I get the error "Data type mismatch in
criteria expression."
private void InsertData()
{
// Read in the file
FileStream fsBLOBFile = new FileStream("Toolbox Folder.ico",
FileMode.Open, FileAccess.Read);
Byte[] bytBLOBData = new Byte[fsBLOBFile.Length];
fsBLOBFile.Read(bytBLOBData, 0, bytBLOBData.Length);
fsBLOBFile.Close();
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=xbr.mdb;";
myCommand.CommandText = "Update MenuItems SET ImageSmall =
(@BLOBData) WHERE MenuKey ='0';";
myCommand.Connection = conn;
OleDbParameter prm = new OleDbParameter("@BLOBData",
OleDbType.LongVarBinary, bytBLOBData.Length, ParameterDirection.Input,
false, 0, 0, null, DataRowVersion.Current, bytBLOBData);
myCommand.Parameters.Add(prm);
conn.Open();
myCommand.ExecuteNonQuery();
conn.Close();
}
Any help would be appreciated.