Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Basics
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 19th, 2004, 05:50 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default Microsoft VBScript runtime (0x800A01B6)

I'm sure this is very simple, but I am missing something here. (It's my first time)

I'm using VBScript to get some data from a database using ADO, but I'm not able to use any methods on my recordset object. Please help!!!

Error:
Error Type:
Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'EOF'
/CE9/asptest.asp, line 23

Likewise, it fails on rs.MoveNext or rs.GetRows.

<%language = "VBScript" %>
<html>
<head>
    <title>ASP Test</title>
</head>
<body>
    <%response.Write "TEST" & "<BR><BR><BR><BR>"

    Dim rs, qry, connstr, adoConn, nextloginName, adoCmd, dataArray

    connstr = "Provider = SQLOLEDB; Data Source = server; Initial Catalog = database; User ID = user; Password = user"
    qry = "select loginname from users order by loginname"
    Set adoConn = Server.CreateObject("ADODB.Connection")
    adoConn.ConnectionString = connstr
    adoConn.Open

    Set rs = Server.CreateObject("ADODB.RecordSet")
    Set rs.ActiveConnection = adoConn
    rs = adoConn.Execute(qry)

    Response.Write "Using Move Next <BR>"
    while NOT rs.EOF
        response.write rs("loginname") & "<br>"
        rs.MoveNext
        response.write rs("loginname") & "<br>"
        rs.MoveNext
    wend

    %>
</body>
</html>


Reply With Quote
  #2 (permalink)  
Old February 19th, 2004, 06:00 PM
Friend of Wrox
 
Join Date: Aug 2003
Location: , , .
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Check to see if the connection string opened. Also once you have set the rs object and the active connection why not use the recordset.open command instead of connection.execute. You should put some error trapping to see what line the error first occurs at.
Reply With Quote
  #3 (permalink)  
Old February 19th, 2004, 06:04 PM
Authorized User
 
Join Date: Aug 2003
Location: , , .
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Connection string is working. I can get the script to print the first record on the web page, but I cannot user MoveNext or any other method on rs, to be able to navigate through rs.

all these methods give me the same error:
MoveNext, EOF, GetRows, RecordCount


In the code I provided, the error occurs at:
while NOT rs.EOF

and the error is: Microsoft VBScript runtime (0x800A01B6)
Object doesn't support this property or method: 'EOF'


Thanks







Quote:
quote:Originally posted by Yehuda
 Check to see if the connection string opened. Also once you have set the rs object and the active connection why not use the recordset.open command instead of connection.execute. You should put some error trapping to see what line the error first occurs at.
Reply With Quote
  #4 (permalink)  
Old February 19th, 2004, 06:36 PM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

If you're using the Execute method of the Connection object, there is no need to define a Recordset first. Instead, assign the results of the Execute method directly to the recordset.

Even if you don't do this, you still need to use Set to assign the Recordset:
Code:
' Set rs = Server.CreateObject("ADODB.RecordSet") -- Not needed
' Set rs.ActiveConnection = adoConn -- Not needed
Set rs = adoConn.Execute(qry)
HtH,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old February 23rd, 2004, 02:14 AM
Friend of Wrox
 
Join Date: Sep 2003
Location: Minneapolis, MN, USA.
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
Default

Try this and see what happens.

cn = "Provider = SQLOLEDB; Data Source = server; Initial Catalog = database; User ID = user; Password = user"

set rs = server.createobject("adodb.recordset")
sql = "select loginname from users order by loginname"
rs.open sql, cn
if not rs.eof then
    do while not rs.eof
        response.write rs("loginname") & "<br>"
    rs.movenext
    loop
end if
rs.close
set rs = nothing
Reply With Quote
  #6 (permalink)  
Old June 22nd, 2004, 01:43 AM
Registered User
 
Join Date: Jun 2004
Location: Bangalore, Karnataka, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'm also facing the same problem but in different scenario... I'm going to get the data from database through a COM+ DLL(Developed in Delphi 5.0 on Windows 2000 Prof with SQL Server 2000) . In the DLL i am able to get the Data (Tested by writing the data to a log file). but in the ASP File i'm getting the 0x800A01B6 error. Can anybody guide me where i'm doing the mistake...

Here is my ASP code...where COMPro.COMProImpl is a COM+ Application.
<%
set FCOMObj = CreateObject("COMPro.COMProImpl")
if (Err.number <> 0) then
  Response.Write("Error " & Err.description) & "<br>"
end if

FRSet=FCOMObj.SelectSQL(FSQL) <--This will return a "_RecordSet" MDAC 2.8
if (Err.number <> 0) then
  Response.Write("Error " & Err.description) & "<br>"
end if

Response.Write("1111111111111111") & "<br>"

if IsObject(FRSet) then
    Response.Write("FRecSet is an object ") & "<br>"
else
    Response.Write("FRecSet is not an object ") & "<br>"
end if

do until FRSet.EOF <------ Here i'm getting that error...
  FRegID = FRSet("RegistrationID") & "<br>"
  Response.Write(FRegId)
  FRSet.MoveNext
loop

set FCOMObj = nothing
set FRSet = nothing
%>
Reply With Quote
  #7 (permalink)  
Old June 22nd, 2004, 01:58 AM
Imar's Avatar
Wrox Author
Points: 72,055, Level: 100
Points: 72,055, Level: 100 Points: 72,055, Level: 100 Points: 72,055, Level: 100
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,086
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

If you're facing the exact same problem, than I assume the exact same solution applies to you as well.....
Please read my earlier post for the answer. You'll need to use the Set keyword.

Cheers,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
While typing this post, I was listening to: Under The Bridge by Red Hot Chili Peppers (Track 11 from the album: Blood Sugar ************ Magik) What's This?
Reply With Quote
  #8 (permalink)  
Old June 22nd, 2004, 01:59 AM
Friend of Wrox
 
Join Date: Oct 2003
Location: Cochin, Kerala, India.
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to madhukp
Default

Hello texasraven,

I can see two movenext statements inside the while loop. This is causing the problem. When your recordset fetches even number of records, it will work correctly. But when the number is odd, it will create problem at the second movenext statement. It would have reached EOF at the first movenext statement. Another call to movenext will cause problem.
Reply With Quote
  #9 (permalink)  
Old June 23rd, 2004, 12:25 AM
Registered User
 
Join Date: Jun 2004
Location: Bangalore, Karnataka, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yeah! thanks it worked...
Reply With Quote
  #10 (permalink)  
Old June 23rd, 2004, 03:05 AM
Registered User
 
Join Date: Jun 2004
Location: Bangalore, Karnataka, India.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

When i call that asp page through internet Explorer i am getting the following Output (error). Can anyone please guide me, how can i overcome this ? (I placed the asp code in my previous posting)

Description : The user has given all rights except administrator rights.

What type of permissions the user need to create an object..?

The site from where i'm accessing this page, it is with SSL (i mean secured). I'm able to get the results perfectly when i tried the same thing in my localhost.

0000000000000000


Server object error 'ASP 0178 : 80070005'

Server.CreateObject Access Error

/test/comapp.asp, line 23

The call to Server.CreateObject failed while checking permissions. Access is denied to this object.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Microsoft VBScript runtime (0x800A0005) mail1 Classic ASP Basics 4 March 27th, 2008 03:42 PM
Microsoft VBScript runtime (0x800A0005) Swetz Classic ASP Components 0 May 14th, 2006 03:44 AM
Microsoft VBScript runtime (0x800A000D) stitch Classic ASP Basics 1 April 27th, 2006 02:23 PM
Microsoft VBScript runtime (0x800A0009) ppenn Classic ASP Databases 2 December 15th, 2003 01:15 PM



All times are GMT -4. The time now is 03:45 AM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.