Databound datetimepicker not sending Value to datasource


I have a couple of datetimepickers in my Windows form, for two date values in a SQL Server database.

I supposed the datetimepickers are correctly bound, since they correctly show the value in the database.

However, when I try to add a new record through the form, I pick a date from the datetimepicker, and I get an error that the column can't be null (which is correct according to my DB).
But I did pick a value!!

Also, I tried by adding the "Checkbox" functionality in my datetime picker, expecting it could make the trick, but it didn't I get the same error.

Oh, but get this. The datetimepicker does work correctly to change values in an existing record (which was filled directly into SQL Server).
So, it only fails with new records

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.

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
fischermxAuthor Commented:

That code does not even compile in VS 2010, .Net 4.0.

I get an error:
      Cannot create an instance of the static class 'System.Nullable'      

But I think that's not related anyway.
This is not about having or not having nulls in the database. It is that the datetimepicker values don't get to the datatable.

I've just realized that the datetimepicker were bound to myDataSet.MyTable, and MyDateColumn.
I changed that to bind to the databindingSource instead and that worked.

But, in the examples I see everywhere, people ties datetimepicker to datatables.
Why doesn't work in my code?
Is this caused by the presence of a databindingSource?

IMHO, when you bind a new record, data values are null (unless you specified default values). Since datetimepicker does not allow null values to be bounded thats why the example I sent you adjusts this feature to allow nullable data to be bounded first before you even start to bound new null data.
fischermxAuthor Commented:
Thanks for the link to the article.
But my problem was not about nullable date, but the column not being updated.

I fixed it by changing the databinding from the datatable to a bindingsource.
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
.NET Programming

From novice to tech pro — start learning today.