02 May 2009

Solution to the “You tried to assign the Null value to a variable that is not a Variant data type.” Exception

By default the DataSource wizard passes parameters for AutoNumber primary keys.  If you are getting this error: You tried to assign the Null value to a variable that is not a Variant data type.

Then you need to remove that default parameter.

This is what Visual Studio adds by default:

   1:  InsertCommand="INSERT INTO [Partner] ([PartnerId], [PartnerGuid], [Name]) VALUES (?, ?, ?)" 

Remove the primary key like so

   1:  InsertCommand="INSERT INTO [Partner] ([PartnerGuid], [Name]) VALUES (?, ?)" 



Filed under: , , , ,
 

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

# Solution to the ???You tried to assign the Null value to a variable that is not a Variant data type.??? Exception | Microsoft Share Point said:

PingBack from http://microsoft-sharepoint.simplynetdev.com/solution-to-the-%e2%80%9cyou-tried-to-assign-the-null-value-to-a-variable-that-is-not-a-variant-data-type%e2%80%9d-exception/

02 May 09 at 9:42 PM

Leave a Comment

Comment Policy: No HTML allowed. URIs and line breaks are converted automatically. Your e–mail address will not show up on any public page.

(required) 
(optional)
(required) 

  
Enter Code Here: Required
Page view tracker