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

January 23rd, 2004, 06:49 PM
|
Registered User
|
|
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Microsoft VBScript runtime error '800a01a8'
Hi Everyone,
I am very new to asp and i have a recurring problem thats giving me grief. I am trying to display data from three tables in an MS Access database. Here is my code:-
<html>
<head>
<title>Magazine Orders</title>
</head>
<body background="backg8.jpg" bgproperties=fixed>
<table border="1">
<tr>
<td colspan=7 align=center>Magazine Orders</td>
</tr>
<tr>
<th>Customer Name</th>
<th>E-mail</th>
<th>Telephone Number</th>
<th>Magazine Issue Number</th>
<th>Caption</th>
</tr>
<%
dim con, Rs
dim t1,t2,t3,t4,t5, Sqlquery
set con=server.createObject("ADODB.Connection")
con.open "name"
Sqlquery = "SELECT Customers.CUS_NAME, Customers.EMAIL, Customers.PHONE_NUMBER, Magazines.ISSUE_NO, Magazines.CAPTION" &_
"FROM Magazines INNER JOIN (Customers INNER JOIN Customers_Magazines ON Customers.CUS_ID = Customers_Magazines.CUS_ID) ON Magazines.ISSUE_NO = Customers_Magazines.ISSSUE_NO" &_
set Rs = Con.Execute( Sqlquery )
%>
<%
while not Rs.EOF
t1=Rs("CUS_NAME")
t2=Rs("EMAIL")
t3=Rs("PHONE_NUMBER")
t4=Rs("ISSUE_NO")
t5=Rs("CAPTION")
Response.Write "<TR><TD>" & (t1) & "</TD>"
Response.Write "<TD>" & (t2) & "<TD>"
Response.Write "<TD>" & (t3) & "<TD>"
Response.Write "<TD>" & (t4) & "<TD>"
Response.Write "<TD>" & (t5) & "<TD><TR>"
Rs.MoveNext
Wend
Rs.close
Con.close
set Rs=nothing
Set Con=nothing
%>
</table>
</body>
</html>
----------------------------------------------------------------------------------------------------------------------------------------------------------------------
I get this error:
--------------------------------------------------------------------
Microsoft VBScript compilation error '800a03ea'
Syntax error
/name/view_mag_ord.asp, line 30
set Rs = Con.Execute( Sqlquery )
^
-------------------------------------------------------------------------
i've had this problem before, played with the asp and get other errors. its just a vicious cycle of errors. its getting really frustating now. i need help!!!
i am thinking the problem is not with the line in question but somewhere else. Can someone please be kind enough to cross-check my code and make suggestions? Thanks in advance.
|

January 24th, 2004, 04:48 AM
|
Registered User
|
|
Join Date: Jan 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I don't usually use the Execute method, but rather the Open method of the recordset object. But my gut tells me you don't have enough info to open the connection. For Jet databases, you need to specify the location of the database on the harddrive, either through an absolute reference, or using Server.Mappath. Here is an example connection to an Access database from my world...
Set cnXN = Server.CreateObject("ADODB.Connection")cnXN.Connec tionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\INetPub\wwwsites\MyWebsite\datasrc\MyWeb site.mdb"
cnXN.Open
Start with that. Then I'd look at my ADO command:
Set cmd = Server.CreateObject("ADODB.Command")
cmd.CommandType=adCmdText
Set cmd.ActiveConnection = cnXN
cmd.CommandText = "YOUR SQL QUERY GOES HERE"
cmd.Execute
Or you could use the open method of the recordset object, as in
Set Rs= Server.CreateObject ("ADODB.RecordSet")
Rs.Open "YOUR SQL QUERY GOES HERE", cnXN, adOpenKeyset, adLockOptimistic
The last 2 properties determine what kind of cursor and reocordlocking you use. There are four options for each. You can get more info online.
Good luck!
|

January 24th, 2004, 05:00 AM
|
 |
Wrox Author
|
|
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
|
|
I think this is causing the problem:
ISSSUE_NO" &_
set Rs = Con.Execute( Sqlquery )
Why are you using the underscore to connect the Rs line with the previous line?
Also, make sure your query is OK,. Before you execute the query, use Response.Write to send it to the browser, and then copy and paste it in your database and see if it runs there.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|

January 25th, 2004, 05:15 PM
|
Registered User
|
|
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi Imar,
Thank you very much for your suggestion. It solved the problem.
Cheers
Quote:
quote:Originally posted by Imar
I think this is causing the problem:
ISSSUE_NO" &_
set Rs = Con.Execute( Sqlquery )
Why are you using the underscore to connect the Rs line with the previous line?
Also, make sure your query is OK,. Before you execute the query, use Response.Write to send it to the browser, and then copy and paste it in your database and see if it runs there.
Cheers,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|
|

January 25th, 2004, 05:18 PM
|
Registered User
|
|
Join Date: Jan 2004
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi everyone,
Thanks for your suggestions to my topic. Imar's reply solved the main part of the problem, and my sql query didn't have a space before the "From" clause.
|
|
 |