NULL values


Author
Message
Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
I took at a number of forum posts but I can't seem to solve my issue with Nulls. I don't use nulls a whole lot.

I have a field in my notes table called ContactFK. (Integer,Nullable).  It's a foreign key to my contacts table. The contact is optional on a note.  I set the NULL value option in the BO Mapper to 'Use Nullable Generic'.

When I set my field to nothing I get an error 'Specified Cast is not valid' on the following line of code:

CType(component, CRMEntryBO).ContactFK = CType(Value, Nullable(Of System.Int32))

Is there something wrong with this setup?  I used Nullable generic a while back for a System.Double and it worked fine.

Thanks

TIm

 


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
Try setting it to Return Alternate value on NULL and then return a zero without any quotes.  See if this resolves the error in your environment.
Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
Unfortunatley I got the same result. 'Invalid Cast DBNull to Integer'

What's the best way to handle the following situation. (I can use NULL or Not Null, as long as I get it working). 

I have a note table with a field called NoteContact (Int). It's a FK to my contacts table. I do not have to specify a contact for my note.

I have a combobox on my form bound to my NoteContact field. I populate using the population data source settings. I display the contact name on the dropdown and my value member is the contact PK. I should mention that my combobox type is a dropdown.  I need to be able to clear the value (I guess a zero or NULL value) or enter a contact that currently doesn't exist in the list. (I have logic to automatically create a new contact).

Thanks,

Tim

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
Is this field in the table structures you sent me the other day?  If so I will look at this when I look at your table structure.
Tim Dol
Tim Dol
StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)StrataFrame User (446 reputation)
Group: Forum Members
Posts: 340, Visits: 1.4K
The table is not in the database I sent you.
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