0
Answer

Insert Binary Array into a row.

Ask a question
patrick

patrick

15y
3.8k
1
I deleted my other post because I've narrowed down the problem. The data type of the "Data" field is image.

public static void serializeAndStoreData(Data D){
ADODB.Connection conData = new ADODB.Connection();
string strSQL;
object obj = new object();
Guid g = Guid.NewGuid();
Byte[] B = new byte[10];
B=ObjectByteArrayConverter.ObjectToByteArray(D);
conData.Open("Provider=Microsoft.Jet.OLEDB.4.0;"+ "Data Source=" +Properties.Settings.Default.networkedConString, "", "", 0);
strSQL = "INSERT INTO Test (ID, Data) VALUES('" + g + "', '" + B + "' );";
conData.Execute(strSQL, out obj, 0);
conData.Close();
}
I know the serialize works. for some reason, when i pull out data and cast it to byte[], it isnt right. For example, a byte[2000] goes into the database and comes out as byte[30].