varbinary(max) to store an image.


Author
Message
Ross L Rooker, Sr.(1)
Ross L Rooker, Sr.(1)
StrataFrame User (236 reputation)StrataFrame User (236 reputation)StrataFrame User (236 reputation)StrataFrame User (236 reputation)StrataFrame User (236 reputation)StrataFrame User (236 reputation)StrataFrame User (236 reputation)StrataFrame User (236 reputation)StrataFrame User (236 reputation)
Group: StrataFrame Users
Posts: 50, Visits: 163
Getting this error:

An exception of type 'MicroFour.StrataFrame.Business.BusinessLayerException' occurred in MicroFour StrataFrame Business.dll but was not handled in user code. Additional information: An error occurred while refreshing the data from field 'tbvo_Groupi.GI_PICTURE' to property 'Image' on control 'pictureBox1.'  Are you missing FieldPropertyDescriptor for a custom property?

pictureBox1 is MicroFour.StrataFrame.UI.Windows.Forms.PictureBox

The GI_PICTURE column in a SQL table has the type: varbinary(max).

The BO tbvo_Groupi column GI_PICTURE has a type of System.Byte[]. The Custom Field Properties NULL Value Option is "Don't Allow Nulls". The box for "Use Custom Code" is checked. Here is the custom code:

[Browsable(false), BusinessFieldDisplayInEditor(), Description("GIpicture"), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)]
        public System.Drawing.Bitmap GI_PICTURE
        {
            get
            {
                object loValue;
                loValue = this.CurrentRow["GI_PICTURE"];
                if (loValue == DBNull.Value)
                {
                    return new System.Drawing.Bitmap(1, 1);
                }
                else
                {
                    try
                    {
                        return (System.Drawing.Bitmap)this.BinaryFormatter.Deserialize(new System.IO.MemoryStream((Byte[])loValue));
                    }
                    catch
                    {
                        return new System.Drawing.Bitmap(1, 1);
                    }
                }
            }
            set
            {
                System.IO.MemoryStream loStream = new System.IO.MemoryStream();
                this.BinaryFormatter.Serialize(loStream, value);
                this.CurrentRow["GI_PICTURE"] = loStream.ToArray();
            }
        }


 



Reply
StrataFrame Team
S
StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)StrataFrame Developer (6.5K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Ah, just remembered that there is a checkbox in the customization dialog in the BOMapper that needs to be checked.  It tells the BOMapper to create the property descriptor for the custom property.  Since you can use the custom code to snuff the property creation, we don't put out a property descriptor by default.  
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
Ross L Rooker, Sr.(1) - 11 Years Ago
StrataFrame Team - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
StrataFrame Team - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
StrataFrame Team - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
StrataFrame Team - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
StrataFrame Team - 11 Years Ago
     YES!!!! Perfect.
Ross L Rooker, Sr.(1) - 11 Years Ago
             Awesome. Glad it's working for you :)
StrataFrame Team - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
StrataFrame Team - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago
StrataFrame Team - 11 Years Ago
Ross L Rooker, Sr.(1) - 11 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search