Here is the error:Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'.
And, here's the code (offending line specified):
private class Field_sketch_Descriptor : MicroFour.StrataFrame.Business.FieldPropertyDescriptor
{
public Field_sketch_Descriptor() : base("sketch") { }
private System.Type _PropertyType = typeof(System.Byte[]);
public override object GetValue(Object component)
{
return ((PartsBO)component).sketch;
}
public override void SetValue(Object component, object Value)
{
((PartsBO)component).sketch = (System.Byte[])Value; <---offending line
}
public override System.Type PropertyType
{
get
{
return this._PropertyType;
}
}
public override System.Type ComponentType
{
get
{
return _ComponentType;
}
}
}I must have done something different to my previous data table...like set all null values to an empty byte array, or something. It worked before my recent re-import of the data. I'll have to review my records to see what might have happened.
Would you suggest a default value for the 'image' field in a SQL Server data table? Or, would a null value be acceptable? If a null is acceptable, how should I handle it in the BO? Then, how would I handle it in the PictureEdit control?
Thanks!
Bill