Images and Null Values


Author
Message
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I do not know what happened.  All was going quite well.  The demo Friday was excellent...no errors in the presentation.  One of the users suggested that I reimport our part data so that the two systems are synchronized on Monday.  No problem.  I had the SQL script ready to fire in that event. 

Last night I ran the import.  No problems.

Today, users are sending me lots of error windows.  In my initial investigation, I ran across a problem with the image field in the part table.  It was working fine before, but now it won't handle null data.  This just doesn't make sense.  I ran the DevEx update to the most recent control suite and also reset the Inherited UI project.  No problems with that; however, that makes no difference. 

What could I have done to mess up my image handling?

Thanks!
Bill

Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
The specific error that I am getting is "{"Unable to cast object of type 'System.DBNull' to type 'System.Byte[]'."}". 

This is the property code on which the error occurs:

public System.Byte[] sketch
{
   
get
   
{
       
return (System.Byte[])this.CurrentRow["sketch"];  <---error fires on this line!
    }
   
set
   
{
       
this.CurrentRow["sketch"] = value;
    }
}

I thought I would try the old replace value on null trick, but I cannot seem to get the C# syntax right.  But, then I keep thinking that I did not have to do that before the import.  It was working fine with the code above. 

Thoughts, anyone?
Bill


Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
I added the following syntax to the replacement value:

new byte[] {}

That works...but I still do not know what went wrong.

Doze

Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
I see how the error manifested itself, but I am not sure what changed between your versions.  Your correction is the same thing that I would have done...but without further investigation I am not sure I could give you a straight answer Smile
Bill Cunnien
Bill Cunnien
StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)StrataFrame VIP (1.1K reputation)
Group: Forum Members
Posts: 785, Visits: 3.6K
No biggie...I will take a pragmatic approach on this one.  It is working, so I'll just tip-toe as I walk by any of that code in the future.
StrataFrame Team
S
StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)StrataFrame Developer (4.4K reputation)
Group: StrataFrame Developers
Posts: 3K, Visits: 2.5K
Seems to be that when you had the version working, there were no NULL values in the database for your testing data, but when you merged the two databases, several of the images were missing and were replaced by NULLs.  BTW, by default, a StrataFrame business object will insert an empty array for a byte[] field, so any new rows generated through the business objects would not have thrown the error.  However, when you set the AllowNullValuesOnNewRow property to true, the NULL value is not replaced, so you could then end up with NULL values in that field.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search