patrick

patrick

  • NA
  • 397
  • 0

Insert Binary Array

Jun 25 2009 4:12 PM
Im trying to stick a binary[] into a file using c#.net. br />
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].

Answers (1)