Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx_professional thread: checking a datareader field to see if its NULL


Message #1 by "Nick Charlesworth" <nick@f...> on Thu, 12 Sep 2002 15:07:06
Hi Nick

I believe it's IsDbNull now.

so:

If Not IsDbNull(objDR("strArtistName")) Then
	strArtist = objDR("strArtistName")
End If

HTH,

Phil

-----Original Message-----
From: Nick Charlesworth [mailto:nick@f...]
Sent: 12 September 2002 16:07
To: ASPX_Professional
Subject: [aspx_professional] checking a datareader field to see if its
NULL


Hi,

I have a string field that I am wishing to assign a field from a 
datareader to

i.e.
Do While objDR.Read
  strArtist = objDR("strArtistName")
  strHTML = "<p>" & strArtist
Loop

However if the record being read has a NULL value for strArtistName then 
it throws an error when assigning the NULL value to the variable of type 
string.

how can i check the value of objDR("strArtistName") for NULL?

I've tried using ISNULL as in ASP 3.0 but this does not work anymore.

thanks,

Nick
---

ASP.NET 1.0 Namespace Reference with C#
http://www.wrox.com/acon11.asp?ISBN=1861007442

ASP.NET 1.0 Namespace Reference with VB.NET
http://www.wrox.com/acon11.asp?ISBN=1861007450

These books are a complete reference to the ASP.NET namespaces 
for developers who are already familiar with using ASP.NET. 
There is no trivial introductory material or useless .NET 
hype and the presentation of the namespaces, in an easy-to use 
alphabetical order ensures a user-friendly reference format.
We provide in-depth coverage of all the major ASP.NET classes, 
giving you those real-world tips that the documentation doesn't 
offer, and demonstrating complex techniques with simple 
examples.  

---

  Return to Index