Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > RS Loop - Numeric value out of range (null)

Reply
Thread Tools

RS Loop - Numeric value out of range (null)

 
 
Adotek
Guest
Posts: n/a
 
      04-02-2007
Hi All,

I am getting this error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC Microsoft Access Driver]Numeric value out of range
(null)
/database/data_entry.asp, line 90

Line 90 is shown below...

// count the total records by iterating through the recordset
for (rsProducts_total=0; !rsProducts.EOF; rsProducts.MoveNext())
{ <---- Line 90
rsProducts_total++;
}

This is an access database, connected to via a DSN.

Any help will be muchly appreciated! I'm stuck on this one!

Thanks!
Simon.

 
Reply With Quote
 
 
 
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      04-02-2007
Adotek wrote:
> Hi All,
>
> I am getting this error:
>
> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> [Microsoft][ODBC Microsoft Access Driver]Numeric value out of range


Nothing to do with your problem, but:
http://www.aspfaq.com/show.asp?id=2126

> (null)
> /database/data_entry.asp, line 90
>
> Line 90 is shown below...
>
> // count the total records by iterating through the recordset
> for (rsProducts_total=0; !rsProducts.EOF; rsProducts.MoveNext())
> { <---- Line 90
> rsProducts_total++;
> }
>

I see nothing here that would cause your odbc driver to return an "out
of range" error. At this point in your code, results have already been
retrieved into your recordset so there should be nothing here for the
database engine or the odbc driver to complain about/
I can only assume that you are mistaken as to which line is actually
line 90. Do some error-trapping so you can determine the actual source
of your error.

However, I will say: this is an insa... I mean ... this is not the
recommended way to get a record count. If all you are doing is counting
the records, then you need to let the database engine do it for you:

sql="select count(*) from table where ... ";
set rs = conn.execute(sql,0,1);
rsProducts_total=rs(0).value;


--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


 
Reply With Quote
 
 
 
 
Adotek
Guest
Posts: n/a
 
      04-02-2007
> > Microsoft OLE DB Provider for ODBC Drivers error '80004005'
> > [Microsoft][ODBC MicrosoftAccessDriver]Numericvalueoutofrange

>
> Nothing to do with your problem, but:http://www.aspfaq.com/show.asp?id=2126

Yup - Agree! I would do it that way. In this case I am fixing someone
elses code.


> line 90. Do some error-trapping so you can determine the actual source
> of your error.

How can I error trap in any more detail? Advice here would be
appreciated.

> However, I will say: this is an insa... I mean ... this is not the
> recommended way to get a record count. If all you are doing is counting
> the records, then you need to let the database engine do it for you:
>
> sql="select count(*) from table where ... ";
> set rs = conn.execute(sql,0,1);
> rsProducts_total=rs(0).value;

Again, I agree...no need to loop! (Not my code!)

Thank you for your reply.



 
Reply With Quote
 
Bob Barrows [MVP]
Guest
Posts: n/a
 
      04-02-2007
Adotek wrote:
>>> Microsoft OLE DB Provider for ODBC Drivers error '80004005'
>>> [Microsoft][ODBC MicrosoftAccessDriver]Numericvalueoutofrange

>>
>> Nothing to do with your problem,
>> but:http://www.aspfaq.com/show.asp?id=2126

> Yup - Agree! I would do it that way. In this case I am fixing someone
> elses code.
>
>
>> line 90. Do some error-trapping so you can determine the actual
>> source
>> of your error.

> How can I error trap in any more detail? Advice here would be
> appreciated.
>


use try ... catch around each line of code that could be generating this
error. I strongly suspect it is earlier in the process, bpresumably when the
recordset is being opened. If you can confirm this, then you need to
concentrate on the sql statement being used to open the recordset. First
step would be to run that sql statement in Access using the Query Builder.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Triple nested loop python (While loop insde of for loop inside ofwhile loop) Isaac Won Python 9 03-04-2013 10:08 AM
int to numeric numeric(18,2) ? jobs ASP .Net 2 07-22-2007 12:32 AM
Arithmetic overflow error converting numeric to data type numeric. darrel ASP .Net 4 07-19-2007 09:57 PM
Need to output "String id" as "Numeric value" in different places using a loop jain_tj@rediffmail.com Javascript 2 04-01-2006 04:13 PM
check if string contains numeric, and check string length of numeric value ief@specialfruit.be C++ 5 06-30-2005 01:08 PM



Advertisments