function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
onCollectonCollect 

Insert null value from SF to Sql Server

Hi,
 
I am inserting field values from SF to my SQL server. Some of my custom fields are empty.
As a result when using binding.Query(to retrieve fields ) it's giving me following error.
 
failed here
Nullable object must have a value.
 
i am using following code to prevent the program from crashing. But its not working.
 

If contact.User_ID__c.Value = False Then

contact.User_ID__c = ""

contact.User_ID__cSpecified = True

cmd.Parameters.AddWithValue("@UserId", contact.User_ID__c)

Else

cmd.Parameters.AddWithValue("@UserId", contact.User_ID__c)

contact.User_ID__cSpecified = True

End If

 
suggestions..
thanks
DevAngelDevAngel
Don't know exactly how you are doing this, but this looks like an ADO.net error.  Check how you are constructing the Table object and make sure that you don't specify any restrictions on the Column objects for the Table.