View Full Version : ASP: VERY new, VERY Confused, VERY help!!!
derekpc
12-17-2004, 12:14 PM
i just started learning ASP today (which is probably the problem) and im tryin to set up an .asp page for linking to an access database. when i run it i get the following error:
"Error Type:
Microsoft VBScript compilation (0x800A03FB)
Expected 'Loop'
/test/Untitled-3.asp, line 28"
if anyone knows why this is doing this could you please explain to me what im doing wrong?
thanks
¥åßßå
12-17-2004, 12:34 PM
While not rsGuestbook.EOF
Response.Write ("<br>")
Response.Write (rsGuestbook("Name"))
Response.Write ("<br>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("<br>")
rsGuestbook.MoveNext
wend
derekpc
12-17-2004, 12:38 PM
ok that worked.. what excactly did that do?
¥åßßå
12-17-2004, 12:40 PM
you forgot to end your loop
While not rsGuestbook.EOF
Response.Write ("<br>")
Response.Write (rsGuestbook("Name"))
Response.Write ("<br>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("<br>")
rsGuestbook.MoveNext
wend
derekpc
12-17-2004, 12:48 PM
ok.. cool thanks for the help
afterburn
12-17-2004, 12:48 PM
usually I use
a
Do until rs.Eof
rs.movenext
Loop
¥åßßå
12-17-2004, 01:29 PM
That makes more sense.
Must admit, i dragged that off an old asp page, usually I'd use a datareader :P
derekpc
12-17-2004, 01:31 PM
this line is giving me problems the majority of the time:
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("guestbook.mdb")
only seldomly can i access the database
is there something i need to set up on my computer or is that not coded right?
¥åßßå
12-17-2004, 01:39 PM
Just noticed, you're leaving your connection open.
Add :-
adoConn.close
after :-
rsGuestbook.Close
derekpc
12-17-2004, 01:45 PM
k i did that but im still getting that damn line 15 error which is that line that i posted before your reply
¥åßßå
12-17-2004, 01:58 PM
Take a look at the folder the db is in, you should be able to tell whether the connection is still open or not (there'll be a locked version of the db)
It may still be locked from when you last ran the code.
derekpc
12-17-2004, 02:01 PM
i only see one copy and it doesn't appear locked
also:
Set rsAddComments = Nothing
Set adoCon = Nothing
do these lines need to be in the code?
¥åßßå
12-17-2004, 02:06 PM
Lol, urm, you're pushing the limits of my asp memory but, I always used to set my connections, recordsets to nothing after I'd closed them.
Have you tried running the code again (since there isn't a locked version of the db) and seeing if it connects (add the adoCon.close first though)
If you watch the folder as the code runs, you should see a locked version of the db appear and then dissapear, if it doesn't dissapear then you've left a connection open and effectively left the db locked.
*edit* have you thought of studying asp.net instead (they're vastly different) it's the newer version of asp and blows it away
derekpc
12-17-2004, 02:12 PM
this time i ran it and the database opened but i dont see a locked file in that directory
i closed the window, ran it again. open fine.. closed it one more time ran it and now its not running again... tried it 3 more times after that and nothing.
putts
12-17-2004, 02:15 PM
best place for connection strings (the string that goes in the databaseConnnection.open line) => www.connectionstrings.com
that'll show you the basic template for an Access database connection string and you should be able to apply it to your world.
Absolutely fastest way to cycle through a recordset in ClASP (Classic ASP) =
set recSet = db.execute(strQuery)
if not(recSet.eof) then
arrTable = recSet.getRows()
recSet.close
recSet = nothing
db.close
set db = nothing
%><table><%
for i=0 to ubound(arrTable,2)
%><tr><%
for j=0 to ubound(arrTable,1)
%><td><%=arrTable(j,i)%></td><%
next
%></tr><%
next
end if
Speedy ole arrays - cant beat em
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.