473,322 Members | 1,409 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,322 software developers and data experts.

ADO/ASP/Isnull issue.

Hello,

Problem: Im using isnull() in vbscript to determine if a field returned
from a ado object call is in fact null. The problem is when I use
isnull in anything other than a response.write() I get the following
error:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the
requested name or ordinal.
/mypage.asp, line 1514

I have double checked spelling, the field Im looking at does infact
exist.

NOTE: I'll use # to denote comments edited into code and output not
actually part of code or output
CODE:
Response.Write("<BRruntime sql is null?" &
isnull(rs.Fields("runtime_sql")))
if not isnull(rs.Fields("runtime_sql")) then
report_fields = report_fields & concat & rs.Fields("runtime_sql")
end if
#debug output.
runtime sql is null?True
#end debug output.
If I remove the not it does not error. if I add an else it does.
After extensive testing Ive determined that if the condidtion in the if
statement is false the page errs.


NOTE2: isnull is used throughout this asp app and this is the first
time it has thrown an err.
Any suggestions?

Thanks in advance,

Jimm

Jan 2 '07 #1
4 5075
ji*********@gmail.com wrote on 2 Jan 2007 08:52:05 -0800:
Hello,

Problem: Im using isnull() in vbscript to determine if a field returned
from a ado object call is in fact null. The problem is when I use
isnull in anything other than a response.write() I get the following
error:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the
requested name or ordinal.
/mypage.asp, line 1514

I have double checked spelling, the field Im looking at does infact
exist.

NOTE: I'll use # to denote comments edited into code and output not
actually part of code or output

CODE:
Response.Write("<BRruntime sql is null?" &
isnull(rs.Fields("runtime_sql")))
if not isnull(rs.Fields("runtime_sql")) then
report_fields = report_fields & concat & rs.Fields("runtime_sql")
end if

#debug output.
runtime sql is null?True
#end debug output.

If I remove the not it does not error. if I add an else it does.
After extensive testing Ive determined that if the condidtion in the if
statement is false the page errs.

NOTE2: isnull is used throughout this asp app and this is the first
time it has thrown an err.

Any suggestions?
If you post the full code that is erroring, it might give a clue as to what
is going wrong. The error message does suggest a typo somewhere though, as
it's the expected response when a column is requested that does not exist in
the recordset.

Dan
Jan 2 '07 #2
chunk of code :

if not isnull(rs("child_report_id")) or (not isnull(rs("link")) and
not isnull(rs("access_level_id"))) then
Response.Write("<BRruntime sql is null?" &
((isnull(rs.Fields("runtime_sql"))) Xor True ))
'debug
dim a
'a = isnull(rs.Fields("runtime_sql"))
' if not a then
' if (isnull(rs.Fields("runtime_sql")) xor true) then
' if isnull(rs.Fields("runtime_sql")) <>
true then

if not isnull(rs.Fields("runtime_sql"))
then
report_fields = report_fields & concat &
rs.Fields("runtime_sql")
end if

'Edebug

if concat="" then
report_fields = report_fields & ", "
end if
column_names = column_names & "DO NOT DISPLAY" & vbTab
column_datatypes = column_datatypes & "99,"
column_funcs = column_funcs & "N,"
if not isnull(rs("link")) then
child_report_ids = child_report_ids & rs("link") & ","
if not isnull(rs("link_display")) then
child_report_displays = child_report_displays &
rs("link_display") & ","
else
child_report_displays = child_report_displays & ","
end if
else
child_report_ids = child_report_ids & rs("child_report_id") & ","
child_report_displays = child_report_displays &
rs("child_report_id") & ","
end if
num_cols = num_cols + 1

if(IsSortField) then
if(rs.Fields("datatype")=1) then
listcount = listcount + 1
end if
stcount = stcount + 1
end if
end if

On Jan 2, 11:07 am, "Daniel Crichton" <msn...@worldofspack.comwrote:
jimm.san...@gmail.com wrote on 2 Jan 2007 08:52:05 -0800:
Hello,
Problem: Im using isnull() in vbscript to determine if a field returned
from a ado object call is in fact null. The problem is when I use
isnull in anything other than a response.write() I get the following
error:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the
requested name or ordinal.
/mypage.asp, line 1514
I have double checked spelling, the field Im looking at does infact
exist.
NOTE: I'll use # to denote comments edited into code and output not
actually part of code or output
CODE:
Response.Write("<BRruntime sql is null?" &
isnull(rs.Fields("runtime_sql")))
if not isnull(rs.Fields("runtime_sql")) then
report_fields = report_fields & concat & rs.Fields("runtime_sql")
end if
#debug output.
runtime sql is null?True
#end debug output.
If I remove the not it does not error. if I add an else it does.
After extensive testing Ive determined that if the condidtion in the if
statement is false the page errs.
NOTE2: isnull is used throughout this asp app and this is the first
time it has thrown an err.
Any suggestions?If you post the full code that is erroring, it might give a clue as to what
is going wrong. The error message does suggest a typo somewhere though, as
it's the expected response when a column is requested that does not exist in
the recordset.

Dan
Jan 2 '07 #3
forgot the sql that generates the rs.

select pr.display as prdisplay,pr.sort_order as prsort_order,
r.value_list, r.report_id,r.field_id, field_sql,
coalesce(r.field_display_name,f.field_display_name ) as
field_display_name, coalesce(rtf.display,r.display) as display,
r.agg_func, coalesce(rtf.sort_order,r.sort_order) as sort_order,
sort_dir, datatype, lookup_field, coalesce(r.field_width,f.field_width)
as field_width, r.child_report_id,
r.runtime_sql,r.link,sa.access_level_id,r.link_dis play from
hl_reportfield r inner join hl_field f on f.field_id=r.field_id left
join screenaccess sa on sa.screen_id=r.screen_id and
sa.access_level_id=103 left join #runtimeFields rtf on
rtf.field_id=r.field_id inner join hl_reportfield pr on
pr.field_id=r.field_id where (r.report_id=1337 and
coalesce(r.enabled,'Y')='Y') and pr.report_id=1337 order by
coalesce(rtf.sort_order,r.sort_order), r.default_order, r.field_id
On Jan 2, 11:19 am, jimm.san...@gmail.com wrote:
chunk of code :

if not isnull(rs("child_report_id")) or (not isnull(rs("link")) and
not isnull(rs("access_level_id"))) then
Response.Write("<BRruntime sql is null?" &
((isnull(rs.Fields("runtime_sql"))) Xor True ))
'debug
dim a
'a = isnull(rs.Fields("runtime_sql"))
' if not a then
' if (isnull(rs.Fields("runtime_sql")) xor true) then
' if isnull(rs.Fields("runtime_sql")) <>
true then

if not isnull(rs.Fields("runtime_sql"))
then
report_fields = report_fields & concat &
rs.Fields("runtime_sql")
end if

'Edebug

if concat="" then
report_fields = report_fields & ", "
end if
column_names = column_names & "DO NOT DISPLAY" & vbTab
column_datatypes = column_datatypes & "99,"
column_funcs = column_funcs & "N,"
if not isnull(rs("link")) then
child_report_ids = child_report_ids & rs("link") & ","
if not isnull(rs("link_display")) then
child_report_displays = child_report_displays &
rs("link_display") & ","
else
child_report_displays = child_report_displays & ","
end if
else
child_report_ids = child_report_ids & rs("child_report_id") & ","
child_report_displays = child_report_displays &
rs("child_report_id") & ","
end if
num_cols = num_cols + 1

if(IsSortField) then
if(rs.Fields("datatype")=1) then
listcount = listcount + 1
end if
stcount = stcount + 1
end if
end if

On Jan 2, 11:07 am, "Daniel Crichton" <msn...@worldofspack.comwrote:
jimm.san...@gmail.com wrote on 2 Jan 2007 08:52:05 -0800:
Hello,
Problem: Im using isnull() in vbscript to determine if a field returned
from a ado object call is in fact null. The problem is when I use
isnull in anything other than a response.write() I get the following
error:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the
requested name or ordinal.
/mypage.asp, line 1514
I have double checked spelling, the field Im looking at does infact
exist.
NOTE: I'll use # to denote comments edited into code and output not
actually part of code or output
CODE:
Response.Write("<BRruntime sql is null?" &
isnull(rs.Fields("runtime_sql")))
if not isnull(rs.Fields("runtime_sql")) then
report_fields = report_fields & concat & rs.Fields("runtime_sql")
end if
#debug output.
runtime sql is null?True
#end debug output.
If I remove the not it does not error. if I add an else it does.
After extensive testing Ive determined that if the condidtion in the if
statement is false the page errs.
NOTE2: isnull is used throughout this asp app and this is the first
time it has thrown an err.
Any suggestions?If you post the full code that is erroring, it might give a clue as to what
is going wrong. The error message does suggest a typo somewhere though, as
it's the expected response when a column is requested that does not exist in
the recordset.
Dan
Jan 2 '07 #4
No worries I wrote a workaround into a diff part of the app
ji*********@gmail.com wrote:
forgot the sql that generates the rs.

select pr.display as prdisplay,pr.sort_order as prsort_order,
r.value_list, r.report_id,r.field_id, field_sql,
coalesce(r.field_display_name,f.field_display_name ) as
field_display_name, coalesce(rtf.display,r.display) as display,
r.agg_func, coalesce(rtf.sort_order,r.sort_order) as sort_order,
sort_dir, datatype, lookup_field, coalesce(r.field_width,f.field_width)
as field_width, r.child_report_id,
r.runtime_sql,r.link,sa.access_level_id,r.link_dis play from
hl_reportfield r inner join hl_field f on f.field_id=r.field_id left
join screenaccess sa on sa.screen_id=r.screen_id and
sa.access_level_id=103 left join #runtimeFields rtf on
rtf.field_id=r.field_id inner join hl_reportfield pr on
pr.field_id=r.field_id where (r.report_id=1337 and
coalesce(r.enabled,'Y')='Y') and pr.report_id=1337 order by
coalesce(rtf.sort_order,r.sort_order), r.default_order, r.field_id
On Jan 2, 11:19 am, jimm.san...@gmail.com wrote:
chunk of code :

if not isnull(rs("child_report_id")) or (not isnull(rs("link")) and
not isnull(rs("access_level_id"))) then
Response.Write("<BRruntime sql is null?" &
((isnull(rs.Fields("runtime_sql"))) Xor True ))
'debug
dim a
'a = isnull(rs.Fields("runtime_sql"))
' if not a then
' if (isnull(rs.Fields("runtime_sql")) xor true) then
' if isnull(rs.Fields("runtime_sql")) <>
true then

if not isnull(rs.Fields("runtime_sql"))
then
report_fields = report_fields & concat &
rs.Fields("runtime_sql")
end if

'Edebug

if concat="" then
report_fields = report_fields & ", "
end if
column_names = column_names & "DO NOT DISPLAY" & vbTab
column_datatypes = column_datatypes & "99,"
column_funcs = column_funcs & "N,"
if not isnull(rs("link")) then
child_report_ids = child_report_ids & rs("link") & ","
if not isnull(rs("link_display")) then
child_report_displays = child_report_displays &
rs("link_display") & ","
else
child_report_displays = child_report_displays & ","
end if
else
child_report_ids = child_report_ids & rs("child_report_id") & ","
child_report_displays = child_report_displays &
rs("child_report_id") & ","
end if
num_cols = num_cols + 1

if(IsSortField) then
if(rs.Fields("datatype")=1) then
listcount = listcount + 1
end if
stcount = stcount + 1
end if
end if

On Jan 2, 11:07 am, "Daniel Crichton" <msn...@worldofspack.comwrote:
jimm.san...@gmail.com wrote on 2 Jan 2007 08:52:05 -0800:
Hello,
Problem: Im using isnull() in vbscript to determine if a field returned
from a ado object call is in fact null. The problem is when I use
isnull in anything other than a response.write() I get the following
error:
Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the
requested name or ordinal.
/mypage.asp, line 1514
I have double checked spelling, the field Im looking at does infact
exist.
NOTE: I'll use # to denote comments edited into code and output not
actually part of code or output
CODE:
Response.Write("<BRruntime sql is null?" &
isnull(rs.Fields("runtime_sql")))
if not isnull(rs.Fields("runtime_sql")) then
report_fields = report_fields & concat & rs.Fields("runtime_sql")
end if
#debug output.
runtime sql is null?True
#end debug output.
If I remove the not it does not error. if I add an else it does.
After extensive testing Ive determined that if the condidtion in the if
statement is false the page errs.
NOTE2: isnull is used throughout this asp app and this is the first
time it has thrown an err.
Any suggestions?If you post the full code that is erroring, it might give a clue as to what
is going wrong. The error message does suggest a typo somewhere though, as
it's the expected response when a column is requested that does not exist in
the recordset.
Dan
Jan 2 '07 #5

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

Similar topics

2
by: Bob Cottis | last post by:
I am getting wierd behaviour with IsNull in ASP. I am passing a string (which may be null) to a function. When the string is null, IsNull seems to return false the first time it is called, then...
2
by: Trev | last post by:
I have two tables, tblMTO and tblIMPORT_MTO. If I import an entire MTO into the import table I want to create a delta from it (i.e. leave only the changed items). I have a view (simplified) ...
6
by: Martin | last post by:
Dear Group Just wondered how I can avoid the CHAR(32) to be inserted if @String1 is NULL? SET @String3 = ISNULL(@String1,'') + CHAR(32) + ISNULL(@String2,'') Thanks very much for your...
6
by: Eric J Owens | last post by:
TIA! I recently moved some forms from an a2k mdb file to an a2k adp. There is now an error when opening one of the forms 'the isnull function requires 2 arguments', but I only find references...
4
by: Paul Spratley | last post by:
Hi all Firstly this my first time posting to technical groups - so any mistakes I apologise for in advance. I am trying to count records in several secondary tables for the same run in a...
2
by: Raoul Watson | last post by:
I have used isNull statement for as long as I have used VB.. Recently I am devugging a program and it is very clear that the "IsNull" function sometimes would return a true even when the value is...
16
by: madeleine | last post by:
Please can someone help me, I think I may go mad with this one: Do While Not IsNull(CDate(FormatDateTime(rst!F1.Value, vbShortDate))) If IsNull(CDate(FormatDateTime(rst!F1.Value, vbShortDate)))...
2
by: Hexman | last post by:
Hello All, In SS EE I have nulls in a column. I want to select and eventually change to a zero (its a smallint column). I've tried selecting 'null', 'dbnull', etc. Then I read about the ISNULL...
16
kcdoell
by: kcdoell | last post by:
Hello: When I write new record I have the following code: Private Sub Form_BeforeUpdate(Cancel As Integer) Me!RowIsActive = False 'When a user is creating a new record the following...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.