recordset fields checking against NULL value?

recordset fields checking against NULL value?

am 06.11.2007 08:51:31 von u16758

I've an ASP page with a ADO recordset, namely rst.

how could I check for a NULL value in the VB Script ASP?

Is the below correct?

If rst.Fields("MyColumn") Is NULL Then
....
Else
....
End If

What is the correct way to check a specific column value whether is it NULL
value?

Thanks!

--
Regards,
Pedestrian, Penang.

Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp-db/200711/1

Re: recordset fields checking against NULL value?

am 06.11.2007 08:56:02 von u16758

I've found the answer :

If rst.Fields("MyColumn") Is Nothing Then
...

I was finding the equivalent of DBNull.Value of .NET

pedestrian wrote:
>I've an ASP page with a ADO recordset, namely rst.
>
>how could I check for a NULL value in the VB Script ASP?
>
>Is the below correct?
>
>If rst.Fields("MyColumn") Is NULL Then
> ....
>Else
> ....
>End If
>
>What is the correct way to check a specific column value whether is it NULL
>value?
>
>Thanks!
>

--
Regards,
Pedestrian, Penang.

Message posted via http://www.webmasterkb.com

Re: recordset fields checking against NULL value?

am 06.11.2007 09:13:13 von u16758

The correct one should be:

If (rst.Fields("OldTypeOfLeave") = "NULL") Then
...

pedestrian wrote:
>I've found the answer :
>
>If rst.Fields("MyColumn") Is Nothing Then
>...
>
>I was finding the equivalent of DBNull.Value of .NET
>
>>I've an ASP page with a ADO recordset, namely rst.
>>
>[quoted text clipped - 12 lines]
>>
>>Thanks!
>

--
Regards,
Pedestrian, Penang.

Message posted via WebmasterKB.com
http://www.webmasterkb.com/Uwe/Forums.aspx/asp-db/200711/1

Re: recordset fields checking against NULL value?

am 06.11.2007 09:30:19 von exjxw.hannivoort

pedestrian via WebmasterKB.com wrote on 06 nov 2007 in
microsoft.public.inetserver.asp.db:

> The correct one should be:
>
> If (rst.Fields("OldTypeOfLeave") = "NULL") Then
> ...

"The correct" is a dangerous presumption.

So Null is a string????

[And please do not toppost on usenet]

If isNull(rst.Fields("OldTypeOfLeave")) Then



--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)