 |
| 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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

February 19th, 2004, 05:50 PM
|
|
Authorized User
|
|
Join Date: Aug 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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>
|
|

February 19th, 2004, 06:00 PM
|
|
Friend of Wrox
|
|
Join Date: Aug 2003
Posts: 205
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

February 19th, 2004, 06:04 PM
|
|
Authorized User
|
|
Join Date: Aug 2003
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
|

February 19th, 2004, 06:36 PM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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.
|
|

February 23rd, 2004, 02:14 AM
|
|
Friend of Wrox
|
|
Join Date: Sep 2003
Posts: 171
Thanks: 0
Thanked 1 Time in 1 Post
|
|
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
|
|

June 22nd, 2004, 01:43 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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
%>
|
|

June 22nd, 2004, 01:58 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
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?
|
|

June 22nd, 2004, 01:59 AM
|
|
Friend of Wrox
|
|
Join Date: Oct 2003
Posts: 463
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

June 23rd, 2004, 12:25 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Yeah! thanks it worked...
|
|

June 23rd, 2004, 03:05 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|
 |