Welcome Guest Search | Active Topics | Sign In | Register

DatePicker / smalldatetime db data entry value Options
amillyard
Posted: Friday, December 14, 2007 5:02:48 AM
Rank: Member
Groups: Member

Joined: 11/18/2007
Posts: 18
c#, asp.net 2.0, ii6, visual studi pro v2005

I have a smalldatetime field in the sql 2005 server database record created.

The following script is trying to pull that smalldatetime value into the DatePicker control -- and wanting to display the date retrieved via this control. i.e. when the asp page loads up, it display any previously entered data entry (visibile via the DatePicker control).

This is not so, what I am doing wrong?

Thank you in advance for your time and efforts with this enquiry.

_____________________________________________________________

if (rdr[1] != DBNull.Value)
{
DatePicker_DateMovedToCurrent.SelectedDate = Convert.ToDateTime(rdr[1]);
}
eo_support
Posted: Friday, December 14, 2007 5:32:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,217
Hi,

The only thing I can think of is that "rdr[1] != DBNull.Value" is evaluated as false. When that occurs, your code didn't change SelectedDate. So it retains whatever value that the user has previous entered.

Thanks


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.