473,398 Members | 2,368 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,398 software developers and data experts.

Null value breaking result set

Hello,

I call a stored procedure via classic ASP (1.1). I loop through the results and print out items on a page. Pretty basic concept but what I'm finding is that if a row from the database comes back as null, the next row doesn't display even though it's not null and has data in it. See the code below:

Expand|Select|Wrap|Line Numbers
  1. details1Query = "EXECUTE storedprocedure"
  2. set details1RS = conn.Execute(details1Query)
  3. do while not details1RS.eof
  4.     Response.Write("value1: " & details1RS("value1") & "<br>")
  5.     Response.Write("value2: " & details1RS("value2") & "<br>")
  6.                 Response.Write("value3: " & details1RS("value3") & "<br>")
  7.     Response.Write("value3: " & details1RS("value4") & "<hr>")
  8. details1RS.MoveNext
  9. loop

value1 has text - it will print out fine
value2 is null - Nothing prints
value3 has text - nothing prints
value4 has text - it will print out fine

If I comment out value2 then value3 prints. Any ideas why this would be occuring? It appears that if a value is null then it breaks the next row underneath it. The stored procedure that it is calling joins multiple tables together. value2 and value3 are from different tables. Any information would be helpful.

Thanks
Oct 28 '08 #1
2 2645
DrBunchman
979 Expert 512MB
Hi ssouhrada,

Thats an odd one, have you got any error trapping on your page?

You should be able to fix this by checking for NULLS within your stored procedure. Take a look at the following example:

Expand|Select|Wrap|Line Numbers
  1. SELECT
  2. Name,
  3. ISNULL(Address, ' ') AS Address
  4. FROM PersonTable
The ISNULL function will return whatever you like (in this case a space) whenever it finds a null value.

Hope this helps,

Dr B
Oct 29 '08 #2
Hello,

Thanks for responding. That ISNULL feature of stored procedures will come in handy. What I found that solved my issue was actually the order that the results were coming back via the stored procedure.

Stored Procedure: "storedprocedure"

Select value1, value2, value3, value4 from table


When looping through the results on the page if I were to access value3 first then value1 and value2 were no longer available. This is something that I had to learn the hard way. I don't believe it has anything to do with the value being null or not but just having the earlier results in the table no longer accessible. So what I will need to do is adjust the order of results in the stored procedure to build my page.

Thanks
Oct 29 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: iStrain | last post by:
Hiya. I'm _sure_ this is an FAQ, but Googling hasn't produced the answer in a way I can make sense out of. I know I should get this, but so far no way... I'm creating tables and doing queries in...
102
by: junky_fellow | last post by:
Can 0x0 be a valid virtual address in the address space of an application ? If it is valid, then the location pointed by a NULL pointer is also valid and application should not receive "SIGSEGV"...
99
by: Mikhail Teterin | last post by:
Hello! Consider the following simple accessor function: typedef struct { int i; char name; } MY_TYPE; const char *
9
by: Steve Sargent | last post by:
Hi: I'm trying to debug the following code, and it keeps looping on the if statement: public static bool operator == (OnlineMemberNode first, OnlineMemberNode second) { if(first == null) {
64
by: yossi.kreinin | last post by:
Hi! There is a system where 0x0 is a valid address, but 0xffffffff isn't. How can null pointers be treated by a compiler (besides the typical "solution" of still using 0x0 for "null")? -...
17
by: Mark A | last post by:
DB2 8.2 for Linux, FP 10 (also performs the same on DB2 8.2 for Windoes, FP 11). Using the SAMPLE database, tables EMP and EMLOYEE. In the followng stored procedure, 2 NULL columns (COMM) are...
0
by: kpoman | last post by:
Hi to all, I am trying to use some dll which needs some data types that I can't find in python. From the dll documentation, I am trying to use this: HRESULT IMKWsq::Compress ( VARIANT ...
11
by: CreativeMind | last post by:
hi all, my dropdownlist 'cboUnitTypes' is populating on the base of another dropdownlist1, i have to apply a check on 'cboUnitTypes' like if(cboUnitTypes.value==0)return false; now problem is;...
2
by: qwedster | last post by:
Folk! How to programattically check if null value exists in database table (using stored procedure)? I know it's possble in the Query Analyzer (see last SQL query batch statements)? But how...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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.