Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > smalldatetime Null in SQL for ASP.net Page

Reply
Thread Tools

smalldatetime Null in SQL for ASP.net Page

 
 
=?Utf-8?B?Um9iZXJ0IFdpbGxoaXRl?=
Guest
Posts: n/a
 
      10-06-2005
I have a database with a field used for an approval date set as a
smalldatetime. When the record is initially written it is intended to be
reviewd and approved. However until it is approved it has a null value,
which throws an error in the ASP page that is intended to be used to review
and update. The error is th DBNull to DateTime conversion error.

Any Suggestions?
 
Reply With Quote
 
 
 
 
Patirck Ige
Guest
Posts: n/a
 
      10-06-2005
Show some snippets
"Robert Willhite" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> I have a database with a field used for an approval date set as a
> smalldatetime. When the record is initially written it is intended to be
> reviewd and approved. However until it is approved it has a null value,
> which throws an error in the ASP page that is intended to be used to

review
> and update. The error is th DBNull to DateTime conversion error.
>
> Any Suggestions?



 
Reply With Quote
 
 
 
 
=?Utf-8?B?Um9iZXJ0IFdpbGxoaXRl?=
Guest
Posts: n/a
 
      10-06-2005
Patirck,

Thanks for the quick response. I actually found the solution and will
include it for any other searches

My old code was:

Request.ApprovedDate = drRequests.Item("ApprovedDate")

I wrote new code as follows:

If IsDBNull(drRequests.Item("ApprovedDate")) Then
Request.ApprovedDate = " "
Else
Request.ApprovedDate = Format(drRequests.Item("ApprovedDate"), "d")
End If


Thanks,



"Patirck Ige" wrote:

> Show some snippets
> "Robert Willhite" <(E-Mail Removed)> wrote in
> message news:(E-Mail Removed)...
> > I have a database with a field used for an approval date set as a
> > smalldatetime. When the record is initially written it is intended to be
> > reviewd and approved. However until it is approved it has a null value,
> > which throws an error in the ASP page that is intended to be used to

> review
> > and update. The error is th DBNull to DateTime conversion error.
> >
> > Any Suggestions?

>
>
>

 
Reply With Quote
 
Patirck Ige
Guest
Posts: n/a
 
      10-06-2005
Good you got it working Robert
Patrick

"Robert Willhite" <(E-Mail Removed)> wrote in
message news:(E-Mail Removed)...
> Patirck,
>
> Thanks for the quick response. I actually found the solution and will
> include it for any other searches
>
> My old code was:
>
> Request.ApprovedDate = drRequests.Item("ApprovedDate")
>
> I wrote new code as follows:
>
> If IsDBNull(drRequests.Item("ApprovedDate")) Then
> Request.ApprovedDate = " "
> Else
> Request.ApprovedDate = Format(drRequests.Item("ApprovedDate"),

"d")
> End If
>
>
> Thanks,
>
>
>
> "Patirck Ige" wrote:
>
> > Show some snippets
> > "Robert Willhite" <(E-Mail Removed)> wrote in
> > message news:(E-Mail Removed)...
> > > I have a database with a field used for an approval date set as a
> > > smalldatetime. When the record is initially written it is intended to

be
> > > reviewd and approved. However until it is approved it has a null

value,
> > > which throws an error in the ASP page that is intended to be used to

> > review
> > > and update. The error is th DBNull to DateTime conversion error.
> > >
> > > Any Suggestions?

> >
> >
> >



 
Reply With Quote
 
 
 
Reply

Thread Tools

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
Changing smalldatetime to string .Net Sports ASP .Net 2 11-18-2005 09:32 PM
smalldatetime problem Pat ASP .Net 3 09-02-2005 10:54 AM
SmallDateTime and NULL Values Fred Nelson ASP .Net 1 03-02-2004 06:18 AM
Insert Time into SmallDateTime Column? James Goodman ASP General 4 01-21-2004 03:25 PM
cast from datetime type to smalldatetime type? Salim Af■ar ASP .Net 1 08-01-2003 02:01 PM



Advertisments