Solution to the "You tried to assign the Null value to a variable that is not a Variant data type." Exception
1 min read
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:
InsertCommand="INSERT INTO [Partner] ([PartnerId], [PartnerGuid], [Name]) VALUES (?, ?, ?)"
```text
Remove the primary key like so
```sql
InsertCommand="INSERT INTO [Partner] ([PartnerGuid], [Name]) VALUES (?, ?)" Share:
Share on LinkedIn
Quick Share: Your custom post text has been copied to your clipboard! Click the button below to open LinkedIn's share dialog, then paste it.
💡 Tip: LinkedIn will open in a new tab. Use Ctrl+V (or Cmd+V on Mac) to paste your text.
Note: LinkedIn will show the article preview. You can add your custom text above it.