G
Guest
Hello, I am trying to save a byte array to my sql ce database using a
SqlCeDataAdapter and a DataTable. Here is my code, after I run it the Notes
field(my image field) is still NULL.
SqlCeDatabase db = SqlCeDatabase.Instance;
db.OpenDatabase(MAT_Common.DatabasePath);
//SAVE NOTES IMAGE
DataTable dt = new DataTable();
strSQL = @"Select SignRequestID, Notes From SignRequest Where SignRequestID
= '{" + ID + "}'";
SqlCeDataAdapter da = new SqlCeDataAdapter(strSQL, db.Conn);
SqlCeCommandBuilder cb = new SqlCeCommandBuilder(da);
da.InsertCommand = cb.GetInsertCommand();
da.DeleteCommand = cb.GetDeleteCommand();
da.UpdateCommand = cb.GetUpdateCommand();
da.Fill(dt);
dt.Rows[0].BeginEdit();
dt.Rows[0].ItemArray = new object[] {ID, pic.GetSignature()}; //
GetSignature returns a byte[]
dt.Rows[0].EndEdit();
dt.AcceptChanges();
da.Update(dt);
db.CloseDatabase();
Thanks for any help,
Lindsay
SqlCeDataAdapter and a DataTable. Here is my code, after I run it the Notes
field(my image field) is still NULL.
SqlCeDatabase db = SqlCeDatabase.Instance;
db.OpenDatabase(MAT_Common.DatabasePath);
//SAVE NOTES IMAGE
DataTable dt = new DataTable();
strSQL = @"Select SignRequestID, Notes From SignRequest Where SignRequestID
= '{" + ID + "}'";
SqlCeDataAdapter da = new SqlCeDataAdapter(strSQL, db.Conn);
SqlCeCommandBuilder cb = new SqlCeCommandBuilder(da);
da.InsertCommand = cb.GetInsertCommand();
da.DeleteCommand = cb.GetDeleteCommand();
da.UpdateCommand = cb.GetUpdateCommand();
da.Fill(dt);
dt.Rows[0].BeginEdit();
dt.Rows[0].ItemArray = new object[] {ID, pic.GetSignature()}; //
GetSignature returns a byte[]
dt.Rows[0].EndEdit();
dt.AcceptChanges();
da.Update(dt);
db.CloseDatabase();
Thanks for any help,
Lindsay