PC Review


Reply
Thread Tools Rate Thread

Date Time Picker & Null Values

 
 
John Smith
Guest
Posts: n/a
 
      15th Mar 2005
Hello all:

I am having some difficulty trying to bind some Date Time Picker
controls to a database that may have Null values in some of these
fields. I continue to get the following error:

"Object cannot be cast from DBNull to other types."

I have tried to manually set the values to a valid date but to no avail.

What is the best way to bind these date values to their corresonding
controls given that some may have null values in them?

Thanks,

- John -
 
Reply With Quote
 
 
 
 
VJ
Guest
Posts: n/a
 
      15th Mar 2005
its unfourtunate that DateTime does not handle null properly... One way
could be that you set a date like 01/01/1900 and map that to like a empty
string and then display empty string when you hit 01/01/1900

But others might have a better idea here..

VJ

"John Smith" <(E-Mail Removed)> wrote in message
news:%23k7$(E-Mail Removed)...
> Hello all:
>
> I am having some difficulty trying to bind some Date Time Picker controls
> to a database that may have Null values in some of these fields. I
> continue to get the following error:
>
> "Object cannot be cast from DBNull to other types."
>
> I have tried to manually set the values to a valid date but to no avail.
>
> What is the best way to bind these date values to their corresonding
> controls given that some may have null values in them?
>
> Thanks,
>
> - John -



 
Reply With Quote
 
Alexander Shirshov
Guest
Posts: n/a
 
      16th Mar 2005
John,

Try this:
http://www.omnitalented.com/Blog/#a9...4-ef7070934dc8

HTH,
Alexander

"John Smith" <(E-Mail Removed)> wrote in message
news:%23k7$(E-Mail Removed)...
> Hello all:
>
> I am having some difficulty trying to bind some Date Time Picker controls
> to a database that may have Null values in some of these fields. I
> continue to get the following error:
>
> "Object cannot be cast from DBNull to other types."
>
> I have tried to manually set the values to a valid date but to no avail.
>
> What is the best way to bind these date values to their corresonding
> controls given that some may have null values in them?
>
> Thanks,
>
> - John -



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Set date time picker to null (blank) Webtechie Microsoft Excel Programming 5 22nd Sep 2009 10:41 PM
REQ: need date picker control that is FREE and does not error out on null records Please....TIA...PS...I need to be able to bind it to a data field...TIA Ralph Malph Microsoft Access Forms 0 16th Apr 2005 10:20 PM
I am trying to use the Microsoft Date and Time Picker control and I am getting the following error "an error occured in a call to the windows date and time picker control" in access 2000 Ralph Malph Microsoft Access Forms 0 25th Oct 2004 07:00 PM
MS Date and Time Picker Control defaults to today's date =?Utf-8?B?UmF2aQ==?= Microsoft Outlook VBA Programming 1 22nd Jan 2004 02:48 PM
MS Date and Time Picker Control defaults to today's date =?Utf-8?B?UmF2aQ==?= Microsoft Outlook Program Addins 0 14th Jan 2004 06:31 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:46 AM.