473,732 Members | 1,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Field s("runtime_sql" )))
if not isnull(rs.Field s("runtime_sql" )) then
report_fields = report_fields & concat & rs.Fields("runt ime_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 5092
ji*********@gma il.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.Field s("runtime_sql" )))
if not isnull(rs.Field s("runtime_sql" )) then
report_fields = report_fields & concat & rs.Fields("runt ime_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("chil d_report_id")) or (not isnull(rs("link ")) and
not isnull(rs("acce ss_level_id"))) then
Response.Write( "<BRruntime sql is null?" &
((isnull(rs.Fie lds("runtime_sq l"))) Xor True ))
'debug
dim a
'a = isnull(rs.Field s("runtime_sql" ))
' if not a then
' if (isnull(rs.Fiel ds("runtime_sql ")) xor true) then
' if isnull(rs.Field s("runtime_sql" )) <>
true then

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

'Edebug

if concat="" then
report_fields = report_fields & ", "
end if
column_names = column_names & "DO NOT DISPLAY" & vbTab
column_datatype s = column_datatype s & "99,"
column_funcs = column_funcs & "N,"
if not isnull(rs("link ")) then
child_report_id s = child_report_id s & rs("link") & ","
if not isnull(rs("link _display")) then
child_report_di splays = child_report_di splays &
rs("link_displa y") & ","
else
child_report_di splays = child_report_di splays & ","
end if
else
child_report_id s = child_report_id s & rs("child_repor t_id") & ","
child_report_di splays = child_report_di splays &
rs("child_repor t_id") & ","
end if
num_cols = num_cols + 1

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

On Jan 2, 11:07 am, "Daniel Crichton" <msn...@worldof spack.comwrote:
jimm.san...@gma il.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.Field s("runtime_sql" )))
if not isnull(rs.Field s("runtime_sql" )) then
report_fields = report_fields & concat & rs.Fields("runt ime_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.so rt_order as prsort_order,
r.value_list, r.report_id,r.f ield_id, field_sql,
coalesce(r.fiel d_display_name, f.field_display _name) as
field_display_n ame, coalesce(rtf.di splay,r.display ) as display,
r.agg_func, coalesce(rtf.so rt_order,r.sort _order) as sort_order,
sort_dir, datatype, lookup_field, coalesce(r.fiel d_width,f.field _width)
as field_width, r.child_report_ id,
r.runtime_sql,r .link,sa.access _level_id,r.lin k_display from
hl_reportfield r inner join hl_field f on f.field_id=r.fi eld_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.f ield_id where (r.report_id=13 37 and
coalesce(r.enab led,'Y')='Y') and pr.report_id=13 37 order by
coalesce(rtf.so rt_order,r.sort _order), r.default_order , r.field_id
On Jan 2, 11:19 am, jimm.san...@gma il.com wrote:
chunk of code :

if not isnull(rs("chil d_report_id")) or (not isnull(rs("link ")) and
not isnull(rs("acce ss_level_id"))) then
Response.Write( "<BRruntime sql is null?" &
((isnull(rs.Fie lds("runtime_sq l"))) Xor True ))
'debug
dim a
'a = isnull(rs.Field s("runtime_sql" ))
' if not a then
' if (isnull(rs.Fiel ds("runtime_sql ")) xor true) then
' if isnull(rs.Field s("runtime_sql" )) <>
true then

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

'Edebug

if concat="" then
report_fields = report_fields & ", "
end if
column_names = column_names & "DO NOT DISPLAY" & vbTab
column_datatype s = column_datatype s & "99,"
column_funcs = column_funcs & "N,"
if not isnull(rs("link ")) then
child_report_id s = child_report_id s & rs("link") & ","
if not isnull(rs("link _display")) then
child_report_di splays = child_report_di splays &
rs("link_displa y") & ","
else
child_report_di splays = child_report_di splays & ","
end if
else
child_report_id s = child_report_id s & rs("child_repor t_id") & ","
child_report_di splays = child_report_di splays &
rs("child_repor t_id") & ","
end if
num_cols = num_cols + 1

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

On Jan 2, 11:07 am, "Daniel Crichton" <msn...@worldof spack.comwrote:
jimm.san...@gma il.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.Field s("runtime_sql" )))
if not isnull(rs.Field s("runtime_sql" )) then
report_fields = report_fields & concat & rs.Fields("runt ime_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*********@gma il.com wrote:
forgot the sql that generates the rs.

select pr.display as prdisplay,pr.so rt_order as prsort_order,
r.value_list, r.report_id,r.f ield_id, field_sql,
coalesce(r.fiel d_display_name, f.field_display _name) as
field_display_n ame, coalesce(rtf.di splay,r.display ) as display,
r.agg_func, coalesce(rtf.so rt_order,r.sort _order) as sort_order,
sort_dir, datatype, lookup_field, coalesce(r.fiel d_width,f.field _width)
as field_width, r.child_report_ id,
r.runtime_sql,r .link,sa.access _level_id,r.lin k_display from
hl_reportfield r inner join hl_field f on f.field_id=r.fi eld_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.f ield_id where (r.report_id=13 37 and
coalesce(r.enab led,'Y')='Y') and pr.report_id=13 37 order by
coalesce(rtf.so rt_order,r.sort _order), r.default_order , r.field_id
On Jan 2, 11:19 am, jimm.san...@gma il.com wrote:
chunk of code :

if not isnull(rs("chil d_report_id")) or (not isnull(rs("link ")) and
not isnull(rs("acce ss_level_id"))) then
Response.Write( "<BRruntime sql is null?" &
((isnull(rs.Fie lds("runtime_sq l"))) Xor True ))
'debug
dim a
'a = isnull(rs.Field s("runtime_sql" ))
' if not a then
' if (isnull(rs.Fiel ds("runtime_sql ")) xor true) then
' if isnull(rs.Field s("runtime_sql" )) <>
true then

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

'Edebug

if concat="" then
report_fields = report_fields & ", "
end if
column_names = column_names & "DO NOT DISPLAY" & vbTab
column_datatype s = column_datatype s & "99,"
column_funcs = column_funcs & "N,"
if not isnull(rs("link ")) then
child_report_id s = child_report_id s & rs("link") & ","
if not isnull(rs("link _display")) then
child_report_di splays = child_report_di splays &
rs("link_displa y") & ","
else
child_report_di splays = child_report_di splays & ","
end if
else
child_report_id s = child_report_id s & rs("child_repor t_id") & ","
child_report_di splays = child_report_di splays &
rs("child_repor t_id") & ","
end if
num_cols = num_cols + 1

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

On Jan 2, 11:07 am, "Daniel Crichton" <msn...@worldof spack.comwrote:
jimm.san...@gma il.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.Field s("runtime_sql" )))
if not isnull(rs.Field s("runtime_sql" )) then
report_fields = report_fields & concat & rs.Fields("runt ime_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
14285
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 True the second time. The code follows, am I doing something wrong, or is this a bug? Bob function unquote(st) 'make database string suitable for
2
13961
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) SELECT dbo.tblIMPORT_MTO.ImportID, dbo.tblIMPORT_MTO.MTONo, dbo.tblIMPORT_MTO.Rev AS New_Rev, dbo.tblMTO.Rev AS Old_Rev FROM dbo.tblIMPORT_MTO LEFT OUTER JOIN dbo.tblMTO ON dbo.tblIMPORT_MTO.MTONo = dbo.tblMTO.MTONo Now to get all rows...
6
10967
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 expertise and efforts! Best Regards,
6
10794
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 to IsNull() having 1 argument. Here is an example of the offending code: ----------------------------- Private Sub AEnd_DblClick(Cancel As Integer)
4
10048
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 primary table. However, there might be no records in these secondary tables for the specific run. Hence the sql below returns nulls.
2
9186
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 not Null. Any wild shot or theory as to why this is happening is appreciated. Also, any other alternative is appreciated since I am stuck and cannot proceed without fixing this issue (tried = Null and that doesn't work either). Basically, I...
16
2943
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))) Then MsgBox "this is not actually possible" End If -
2
8316
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 function. From the example I got, I received the "...requires 2 arguments...." error. Read up on it but it doesn't click with me. Could someone explain the error? And secondly, how to select null fields? Thanks,
16
1966
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 code inserts the MonthID, YearID and
0
8944
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
9234
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9180
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8186
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6733
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6030
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4548
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
3259
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.