Column 'a' does not allow null values.

Hello There,
I have a simple table in Sql and a dataset in c#. In order to get the delete and update and save commands I had to make one of the columns a primary key and I made its type int.

I know a primary key cannot allow nulls, so I am not sure how to get around this error

 when I go to send data to the dataset I get the following error:

NoNullAllowedException was unahndled.

Column 'a' does not allow nulls.

            RescueTechDBDataSet.tasksRow newtasksrow = RTDB.tasks.NewtasksRow();

            newtasksrow.trackingnumber = trackingnumber.Text;
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Have you made the primary key field an Identity field as well (to automatically insert and increment values) ?
JasonWinnAuthor Commented:
Yes I made it identity field with the following:
(is identity) : yes
Identity increment: 1
identity seed: 1
...and you are not implicitly attmpting to insert a null value to the identity field?
Exploring SharePoint 2016

Explore SharePoint 2016, the web-based, collaborative platform that integrates with Microsoft Office to provide intranets, secure document management, and collaboration so you can develop your online and offline capabilities.

JasonWinnAuthor Commented:
Not that I am aware of. I just have 4 textboxes trying to put data into 4 columns, the 5th column is the primary key column.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
You can also just use a dummy value.  When the datadapter does the update, the identity column will generate the new primary key and when you refresh your dataset it will have the new value.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.