5
Bu alanları içeren DB'mde bir WorkflowInstances tablosu var: ID (int), Name (nvarchar (50), WorkflowID (int), Belge (varbinary (MAX))). Ben çizgi 15'te bir hata varNasıl yapılır: 'byte []' için 'System.Data.Linq.Binary'
Stream myStream = openFileDialogDoc.OpenFile();
if (myStream != null)
{
using (myStream)
{
WorkflowInstance w = new WorkflowInstance();
byte[] bytes = new byte[myStream.Length];
myStream.Read(bytes, 0, (int)myStream.Length);
w.ID = repository.WorkflowsRepository.GetMaxIDWokflowInstance() + 1;
w.Name = textBoxWorkflowInstanceName.Text;
w.CurrentStateID = repository.WorkflowsRepository.GetWorkflowFirstState((int)listBoxMyWorkflows.SelectedValue);
w.WorkflowID = (int)listBoxMyWorkflows.SelectedValue;
w.CreationDate = System.DateTime.Now.ToString();
w.Document = bytes;
RapidWorkflowDataContext context = new RapidWorkflowDataContext();
context.WorkflowInstances.InsertOnSubmit(w);
context.SubmitChanges();
}
}
bu kodu yazmış böylece Yeni bir WorkflowInstance eklemek istediğiniz, hatadır: örtük türü dönüştürülemez 'byte []' için 'System.Data.Linq.Binary
w.Document = new System.Data.Linq.Binary(bytes);
: '