Re: Help with IIS server Error (Provider error '80040154' Class not registered)

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Bob Barrows [MVP] (reb01501_at_NOyahoo.SPAMcom)
Date: 02/25/05


Date: Thu, 24 Feb 2005 19:58:08 -0500

Martin Franklin wrote:
> I am trying to get a total record count on a Acess 97 mdb database.
> However I get the following error when I try to load the page:
>
> Provider error '80040154' Class not registered

Which one is line 17?

> http://www.assetresearch.com/clog/count.asp
>
> I believe permissions for the IUSR_machine are correct as I am able
> to add and delete records from the database through other ASP pages
> in the site. Any ideas on what Class needs to be re-registered. If
> so, how do I do it?
>
> <%
> set conn=Server.CreateObject("ADODB.Connection")
> conn.Provider="Microsoft.Jet.OLEDB.4.0"
> conn.Open(Server.Mappath("clogin.mdb"))
> conn.CursorLocation = 3
>
> set rs=Server.CreateObject("ADODB.recordset")
> sql="SELECT * FROM users"
> rs.Open sql,conn
>
> if rs.Supports(adApproxPosition)=true then

This is the wrong property to check for Supports. It's Bookmarkability that
determines whether or not the cursor supports recordcount. Anyways, you set
cursorLocation to 3 above, so you have a client-side cursor that
automatically supports recordcount because a client-side cursor is always a
Static cursor which supports recordcount.

> i=rs.RecordCount
> response.write("The number of records is: " & i)
> end if
> rs.Close
> conn.Close
> %>
>
> Any help is this matter is greatly appreciated:)

As a guess, you have an Access97 database which uses Jet 3.51, and you are
using the Jet 4.0 provider to open it. I have never had a problem with this,
but then again, I never use the RecordCount property, so this error may have
been waiting in the wings for me all this time.

Bob Barrows

-- 
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" 


Relevant Pages

  • Re: Implementing combo box control linked to table
    ... var Index: Integer; ... RecordCount is not supported in all database types. ... When I tried my associate's program on my Vista machine, ...
    (comp.lang.pascal.delphi.misc)
  • Re: counting records in a recordset
    ... Recordcount will work if you specify the proper type of cursor (the default ... Since this is a SQL database (MS SQL Server, ... after it is entered using an expensive client-side cursor. ...
    (microsoft.public.inetserver.asp.general)
  • Re: counting records in a recordset
    ... Well this is how it works: the data is entered into a database somewhere, ... > client-side cursor, recordcount will work (do you have the ADO ... >>> Please reply to the newsgroup. ...
    (microsoft.public.inetserver.asp.general)
  • Re: CDatabase CRecordset - How to get the number of rows?
    ... > I'm using Visual C++6 and MFC to connect to a database. ... I've been using the CDatabase class to connect to the ... > Database and have tried a few things using the CRecordset class to try and ... > recordCount = rs.GetRecordCount; ...
    (microsoft.public.vc.mfc)
  • Re: add data from a datagrid
    ... what can I do, I use on a form a datagrid, and a commandbutton. ... .CursorLocation = adUseServer ... Otherwise the RecordCount property may not be correct. ... This would let the database server count up the records, ...
    (microsoft.public.vb.general.discussion)