473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Check for Null

Is there an easier way to check if any of the fields returned in a
select statement have null values?

After running this command:

set rs = conn.execute("select A,B,C,D,E,F,G,H,I,J from SomeTable
where...")

I could check each field this way:

If IsNull(rs("A") Then
Response.Write("The value of A is null")
Else
Response.Write("The value of A is " & rs("A"))
End If

If IsNull(rs("B") Then
Response.Write("The value of B is null")
Else
Response.Write("The value of B is " & rs("B"))
End If

If IsNull(rs("C") Then
Response.Write("The value of C is null")
Else
Response.Write("The value of C is " & rs("C"))
End If

etc.

But is there a simpler way?

Also, my "solution" probably wouldn't work if more than one recordset
was returned...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #1
1 45480
use a null replacement in your SQL statement - I don't kow what DB you are
working with...

an oracle example: set rs = conn.execute("select NVL(A,'IsNull') AS A, ...
from SomeTable where...")
an SQL server example: set rs = conn.execute("select ISNULL(A,'IsNull') AS
A, ... from SomeTable where...")
"Luis" <an**********@webmail.co.za> wrote in message
news:u1****************@TK2MSFTNGP12.phx.gbl...
Is there an easier way to check if any of the fields returned in a
select statement have null values?

After running this command:

set rs = conn.execute("select A,B,C,D,E,F,G,H,I,J from SomeTable
where...")

I could check each field this way:

If IsNull(rs("A") Then
Response.Write("The value of A is null")
Else
Response.Write("The value of A is " & rs("A"))
End If

If IsNull(rs("B") Then
Response.Write("The value of B is null")
Else
Response.Write("The value of B is " & rs("B"))
End If

If IsNull(rs("C") Then
Response.Write("The value of C is null")
Else
Response.Write("The value of C is " & rs("C"))
End If

etc.

But is there a simpler way?

Also, my "solution" probably wouldn't work if more than one recordset
was returned...
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Yi | last post by:
Hi, I have a record set that is bound to a table in MS SQL Server. One filed in the table is bound to a "long" type member variable in the RecordSet. What will happen to the "long" variable when...
18
by: staeri | last post by:
I'm using the following code to create a sum: forecast = forecast + eval(f.value); This only works if "f.value" contains a number. Can someone please help me so that it also works if...
1
by: niks4ward | last post by:
Hi..could nebody please tell me how do i check if the grid cells are NULL or empty on command button click. m working on VB.Net 2005
1
tolkienarda
by: tolkienarda | last post by:
hi all i need to check in a database to see if a value is null i don't remember what i put in for null mysql_query("SELECT name FROM dbase WHERE fcc != NULL"); my question is the part...
1
by: jinnee | last post by:
I received an error in VB.NET: " 'Is' requires operands that have reference types, but this operand has the value type 'Practice.DataStruct' ". I don't understand why the system raises this error....
4
by: RP | last post by:
I have a member variable of a class of type "int", and while assigning value to it in a constructor, I want to check whether it is a null. I am using following code: if (NewMember.BPLNo == null)...
3
by: AccessHunter | last post by:
I have to following VBA code, If IsNull(strSavePtyp) & "" Then rst.Delete End If The problem I am facing right now is, even when the value of strSavePtyp is "" (blank), the...
16
chandru8
by: chandru8 | last post by:
hi to all i am using vb6.0 is there any way to check more textboxes value is null or not because in my form iam having 50 text boxes all should not be null if (text1.text) <> "" and...
2
by: NotGuru | last post by:
I was writing some C extensions for Python and use PyTupleType_Check extensively. I found that all the PySomeType_Check macros directly delegate the job to PyObject_TypeCheck(op, &PyType_Type). The...
4
rsrinivasan
by: rsrinivasan | last post by:
Hi all, I have one table with 24 fields in SQL server. In this some of the fields has NULL value. But i want to get the records which does not have any NULL value in any one of the fields....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.