ASP: VERY new, VERY Confused, VERY help!!!

liunx

Guest
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?
thanksWhile not rsGuestbook.EOF
Response.Write ("<br>")
Response.Write (rsGuestbook("Name"))
Response.Write ("<br>")
Response.Write (rsGuestbook("Comments"))
Response.Write ("<br>")
rsGuestbook.MoveNext
wendok that worked.. what excactly did that do?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
wendok.. cool thanks for the helpusually I use
a

Do until rs.Eof

rs.movenext
LoopThat makes more sense.

Must admit, i dragged that off an old asp page, usually I'd use a datareader :Pthis 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?Just noticed, you're leaving your connection open.
Add :-
adoConn.close

after :-
rsGuestbook.Closek i did that but im still getting that damn line 15 error which is that line that i posted before your replyTake 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.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?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 awaythis 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.best place for connection strings (the string that goes in the databaseConnnection.open line) => <!-- w --><a class="postlink" href="http://www.connectionstrings.com">www.connectionstrings.com</a><!-- w -->

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