...

View Full Version : ASP Novice needs help fixing a page plz



Travo
01-06-2005, 02:08 PM
Hello, Im pretty new to asp but i know c++ and html. Ive got a freeware forum which i want to use for my website and intergrated more of it into the existing website but i cannot get one part to work. I want the forum to use the usernames and id#s of an existing table in the database but its giving me an error. It works prefectly with Mozilla Firefox Browser but in IE it gives me the following error

Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/OTCG/forums/Index.asp, line 103

ive tried everything i can think of to fix it but have gotten nowhere, its probably a quick fix but im too new to figure it out.



here is the code if itll fit

<%
s = request.querystring("s")
if len(s)<1 then s = 0
s=s*10

set db = Server.CreateObject("ADODB.Connection")
connect="Driver={Microsoft Access Driver (*.mdb)}; DBQ="& server.mappath("../fpdb/pkf920.mdb")
db.Open connect
%>

<%
sql = "select title, autor, views, replies, id3, datum_updated, id2 from zForum1 where connected = 0 order by updated desc"
set rs = db.Execute(sql)
while not rs.eof

count = count +1
if count>s and count<=(s+10) then

if count mod 2 = 0 then
bgcolor = "#EFEFDE"
else
bgcolor = "#E3E1E1"
end if
%>
<tr>
<td width="50%" bgcolor="<%=bgcolor%>" align="left"><a class="text" href="forums/view.asp?id2=<%=rs("id2")%>&s=<%=s/10%>"><%=rs("title")%></a></td>
<td width="15%" bgcolor="<%=bgcolor%>" align="center"><a class="text" href="javascript:openWindow('scripts/tcards.asp?ID=<%=rs("ID3")%>')"><%=rs("autor")%></a>
</td>
<td width="10%" bgcolor="<%=bgcolor%>" align="center"><%=rs("views")%></td>
<td width="10%" bgcolor="<%=bgcolor%>" align="center"><%=rs("replies")%></td>
<td width="15%" bgcolor="<%=bgcolor%>" align="center"><%=rs("datum_updated")%></td>
</tr>
<%
end if
rs.movenext
wend

sql = "select count(id2) as alleEintraege from zForum1 where connected = 0"
set rs = db.Execute(sql)
alleEintraege = int(rs("alleEintraege"))
%>
<tr>
<td width="100%" bgcolor="#EFEFDE" colspan = "5" class = "text">
<p align="right">Page
<%for t = 0 to fix((alleEintraege-1)/10)%>
<a class = "text" href="index.asp?s=<%=t%>"><%if t=(s/10) then%><b><%end if%><%=t+1%><%if t=(s/10) then%></b><%end if%></a>&nbsp;
<%next%>
</p>
</td>
</tr>
</table>
</td>
</tr>
</table>



<%
rs.close
set rs = nothing
%>


<%
sql = "select * from Users" _
& " where Username = '" & Session("FootballPoolUsername") & "'"
set rsUsers = Db.Execute(sql)

dim userid, userne, rsUsers
userid = rsUsers("id")
userne = rsUsers("username")


%>
<br>
<form method="POST" action="forums/new.asp">

<input type="hidden" value='<% = userne %>' name="autor">
<input type="hidden" value='<% = userid %>' name="id3">

<table border="0" cellpadding="0" cellspacing="0" width="100" bgcolor="#000000" align="center">
<tr>
<td width="100%">
<table border="0" cellpadding="2" cellspacing="1" width="320" class="text">
<tr>
<td width="389" bgcolor="#848CB5" align="center" colspan="2"><b>NEW POSTING</b></td>
</tr>
<tr>
<td width="70" bgcolor="#EFEFDE" align="left">Title</td>
<td width="319" bgcolor="#EFEFDE" align="left">
<input type="text" name="title" size="34" maxlength="40"></td>
</tr>
<tr>
<td width="394" bgcolor="#EFEFDE" colspan="2" align="left">
<textarea rows="6" name="message" cols="39"></textarea></td>
</tr>
<tr>
<td width="394" bgcolor="#EFEFDE" colspan="2" align="center">
<input type="submit" value="save" name="B1"></td>
</tr>
</table>
</td>
</tr>

<%
db.close
set db = nothing
rsUsers.close
set rsUsers = nothing
%>

tboss132
01-06-2005, 04:44 PM
I checked out your code and there doesn't seem to be anything there that could bring out that error. Maybe you should identify the code on line 103 and indicate this in the code you posted. Also it'll help to wrap the code with code tags before you post.
Do that and it'll help isolate the problem

Travo
01-06-2005, 06:19 PM
I checked out your code and there doesn't seem to be anything there that could bring out that error. Maybe you should identify the code on line 103 and indicate this in the code you posted. Also it'll help to wrap the code with code tags before you post.
Do that and it'll help isolate the problem

ok man, sorry for the messy code :( im not sure how to wrap the code but these are the lines in the error

line-102 dim userid, userne, rsUsers
line-103 userid = rsUsers("id")
line-104 userne = rsUsers("username")

Travo
01-06-2005, 09:29 PM
ive figured out that the problem lays in the line & " where Username = '" & Session("FootballPoolUsername") & "'" because without it, it works but it only takes the first line to that table. This cookies are correct and the Feild Name is correct but it still wount work :mad: anyone know my prob?? thx in advance

<%
sql = "select * from Users" _
& " where Username = '" & Session("FootballPoolUsername") & "'"
set rsUsers = Db.Execute(sql)

NEExt
01-06-2005, 11:38 PM
I don't see anything wrong with the Query, but since you are getting that error I assume it isn't returning a recordset.

Have you tried Response.Write(sql) to ensure that Session("FootballPoolUsername") has a value? And has a value that exists in your DB.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum