Ask a Question related to ASP Database, Design and Development.
-
Goran #1
Please help with IF EOF TRUE
Hello,
I am stuck with EOF TRUE error and not quite sure what I did wrong:
Here is code:
************************************************** **************************
****
<%Response.Buffer=TRUE%>
<%IF session("admin") = FALSE THEN Response.Redirect "admin.asp"%>
<%
tbl = Request.QueryString("which")
If tbl = "users" Then
ttl = "Users"
Else
ttl = "Administrators"
End If
%>
<html>
<head>
<title>Delete <%=ttl%></title>
</head>
<body vlink="#FFFFCC" alink="#FFFF00" link="#FFFFFF">
<div align="center">
<table border="1" cellspacing="4" width="657" height="543" cellpadding="2">
<!-- MSTableType="layout" -->
<tr>
<td valign="top" colspan="2" height="74" bgcolor="#660066">
<!-- MSCellType="ContentHead" -->
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" width="100%" id="table8">
<tr>
<td>
<p align="center"><font color="#FFFFFF" face="Verdana"><b>
<img border="0" src="../images/users.gif" width="32"
height="32"></b></font></td>
<td>
<p align="center"><font color="#FFFFFF"><b>USER MANAGER</b></font></td>
<td>
<p align="center"><font color="#FFFFFF" face="Verdana"><b>
<img border="0" src="../images/key.gif" width="32"
height="32"></b></font></td>
</tr>
</table>
</td>
</tr>
<tr>
<td msopnltype="NavBody" rowspan="2" width="113" valign="top"
bgcolor="#660066">
<!-- MSCellType="NavBody" -->
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" width="100%" id="table7">
<tr>
<td align="center">
<p align="center">
<b><font size="2"><a
href="javascript:history.back(1)">HOME</a></font></b></td>
</tr>
</table>
</td>
<td valign="top" height="419">
<!-- MSCellType="ContentBody" -->
<%
'here is the connection string
Set conn = server.createobject("adodb.connection")
'this connection uses JET 4 it is the prefered method of connecting to an
access database
DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.Mappath("/asplogin/login.mdb")
'if you cant use JET then comment out the line above and uncomment the line
below
'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
Server.Mappath("/asplogin/login.mdb")
conn.Open DSNtemp
SQL = "Select * from "& tbl
pagetot = 10
const adOpenForwardOnly = 0
const adOpenKeySet = 1
const adOpenDynamic = 2
const adOpenStatic = 3
const adLockReadOnly = 1
const adLockPessimistic = 2
const adLockOptimistic = 3
const adLockBatchOptimistic = 4
Set RS = Server.CreateObject("Adodb.RecordSet")
RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
If RS.EOF Then
%>
<table cellspacing="1" border="0" cellpadding="2" width="100%">
<tr>
<td bgcolor="#CC0000">
<p align="center">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<font color="#FFFFFF">Sorry, no records were found. </font> <a
href="javascript:history.back(1)">Back To
<%=ttl%> Manager</a> </font></td>
</tr>
</table>
<font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
<%
ElseIf request("begin") = "" Then
begin = 1
Else
begin = Cint(request("begin"))
End If
tot = ((begin+pagetot)-1)
If tot > RS.RecordCount Then
tot = RS.RecordCount
End If
i = 1
navi = ""
For j = 1 to RS.RecordCount step pagetot
If j <> 1 Then navi = navi & " | "
If j = Cint(begin) Then
navi = navi & "<b>"&i&"</b>"
Else
navi = navi & "<a href="""
navi = navi & Request.ServerVariables("url") & "?begin=" & j &
"&which=" & tbl
navi = navi & """>"
navi = navi & i & "</a>"
End If
i = i + 1
Next
i = 1
RS.Move begin - 1
%> </font>
<p align="center"><b><font size="4">Delete <%=ttl%></font></b></p>
</font>
<%
For x = begin to begin + (pagetot - 1)
If RS.EOF Then exit For
%>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse:
collapse" width="100%" id="table1" bgcolor="#FFFFDD">
<tr>
<td><font face="Verdana" size="2">User Name:</font></td>
<td><font face="Verdana" size="2"><%=RS("uid")%></font></td>
<td><font face="Verdana" size="2">Address:</font></td>
<td><font face="Verdana" size="2"><%=RS("Address")%></font></td>
</tr>
<tr>
<td><font face="Verdana" size="2">Password:</font></td>
<td><font face="Verdana" size="2"><%=RS("pwd")%></font></td>
<td><font face="Verdana" size="2">ZIP Code:</font></td>
<td><font face="Verdana" size="2"><%=RS("ZIP")%></font></td>
</tr>
<tr>
<td><font face="Verdana" size="2">First Name:</font></td>
<td><font face="Verdana" size="2"><%=RS("FirstName")%></font></td>
<td><font face="Verdana" size="2">City:</font></td>
<td><font face="Verdana" size="2"><%=RS("City")%></font></td>
</tr>
<tr>
<td><font face="Verdana" size="2">Last Name:</font></td>
<td><font face="Verdana" size="2"><%=RS("LastName")%></font></td>
<td><font face="Verdana" size="2">Country:</font></td>
<td><font face="Verdana" size="2"><%=RS("Country")%></font></td>
</tr>
<tr>
<td><font face="Verdana" size="2">Phone:</font></td>
<td><font face="Verdana" size="2"><%=RS("PhoneNumber")%></font></td>
<td><font face="Verdana" size="2">Mobile:</font></td>
<td><font face="Verdana" size="2"><%=RS("MobileNumber")%></font></td>
</tr>
<tr>
<td><font face="Verdana" size="2">Fax:</font></td>
<td><font face="Verdana" size="2"><%=RS("Fax")%></font></td>
<td><font face="Verdana" size="2">Notes:</font></td>
<td><font face="Verdana" size="2"><%=RS("Notes")%></font></td>
</tr>
<tr>
<td colspan="4">
<p align="center">
<a href="delete2.asp?which=<%=tbl%>&id=<%=RS("id")%>" >
<img border="0" src="../images/btn_delete.gif" width="70"
height="30"></a></td>
</tr>
<tr>
<td colspan="4" bgcolor="#000000"> </td>
</tr>
</table>
<%
i = i + 1
RS.MoveNext
Next
%>
<table cellspacing="2" cellpadding="2" width="100%">
<tr>
<td align="right">
<font face="Verdana, Arial, Helvetica, sans-serif" size="2">
<b><%=ttl%> <%=begin%>
- <%=tot%> of <%=RS.RecordCount%> Page:</b> <%=navi%> </font>
</td>
</tr>
</table>
<p> </p>
<font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%
RS.Close
Set RS = nothing
Conn.close
Set Conn = Nothing
%> </font>
</td>
</tr>
<tr>
<td valign="top" height="50" width="544" bgcolor="#660066">
<!-- MSCellType="ContentFoot" -->
<p align="center"><font size="2" face="Verdana">
</td>
</tr>
</table>
</div>
</body>
</html>
************************************************** '''
Thank you....
/Goran
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
Version: 6.0.524 / Virus Database: 321 - Release Date: 06.10.2003
Goran Guest
-
#26232 [Opn->Bgs]: in_array produces true when bool true is in haystack
ID: 26232 Updated by: jay@php.net Reported By: me at my dot house -Status: Open +Status: Bogus Bug... -
#26232 [Bgs->Opn]: in_array produces true when bool true is in haystack
ID: 26232 Updated by: helly@php.net Reported By: me at my dot house -Status: Bogus +Status: Open... -
#26232 [Ver->Bgs]: in_array produces true when bool true is in haystack
ID: 26232 Updated by: iliaa@php.net Reported By: me at my dot house -Status: Verified +Status: Bogus... -
#26232 [Ver]: in_array produces true when bool true is in haystack
ID: 26232 Updated by: jay@php.net Reported By: me at my dot house Status: Verified Bug Type: Arrays... -
#26232 [Opn->Ver]: in_array produces true when bool true is in haystack
ID: 26232 Updated by: helly@php.net Reported By: me at my dot house -Status: Open +Status: Verified... -
Bob Barrows #2
Re: Please help with IF EOF TRUE
Aaarghh! Why all the irrelevant html garbage???? You're having a problem
with a vbscript statement! So show us the vbscript code!
Goran wrote:************************************************** **************************> Hello,
> I am stuck with EOF TRUE error and not quite sure what I did wrong:
> Here is code:
><snip>> ****
Bad. Do not use "Select *" in production code. Always spell out the fields> 'here is the connection string
> Set conn = server.createobject("adodb.connection")
> 'this connection uses JET 4 it is the prefered method of connecting
> to an access database
> DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> Server.Mappath("/asplogin/login.mdb")
> 'if you cant use JET then comment out the line above and uncomment
> the line below
> 'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
> Server.Mappath("/asplogin/login.mdb")
> conn.Open DSNtemp
>
> SQL = "Select * from "& tbl
you want your query to return.
[url]http://www.aspfaq.com/show.asp?id=2112[/url]> pagetot = 10
>
> const adOpenForwardOnly = 0
> const adOpenKeySet = 1
> const adOpenDynamic = 2
> const adOpenStatic = 3
> const adLockReadOnly = 1
> const adLockPessimistic = 2
> const adLockOptimistic = 3
> const adLockBatchOptimistic = 4
Bad. You are not planning on updating this particular recordset. Open a> Set RS = Server.CreateObject("Adodb.RecordSet")
> RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
read-only, forward-only recordset. And tell ADO what your command type is:
Const adCmdText = 1
RS.Open SQL, Conn, ,,adCmdText
<snip of inefficient recordset loop>> If RS.EOF Then
> %>Ummm - did I miss something? What's the problem?> ************************************************** '''
> Thank you....
>
Bob Barrows
Bob Barrows Guest
-
Bob Barrows #3
Re: Please help with IF EOF TRUE
Just a hint for you: if you are having a problem with a small part of your
code, strip out all the non-essential stuff (do it in a new page) and
concentrate on getting it working without all the distractions.
In other words, create a page that contains ONLY the server-side asp code
from this page and concentrate on getting that working. Instead of all that
html stuff, use a few response.write statments to help you debug it
HTH,
Bob Barrows
Goran wrote:************************************************** **************************> Hello,
> I am stuck with EOF TRUE error and not quite sure what I did wrong:
> Here is code:
>> ****
> <%Response.Buffer=TRUE%>
> <%IF session("admin") = FALSE THEN Response.Redirect "admin.asp"%>
>
> <%
> tbl = Request.QueryString("which")
> If tbl = "users" Then
> ttl = "Users"
> Else
> ttl = "Administrators"
> End If
> %>
>
> <html>
>
> <head>
> <title>Delete <%=ttl%></title>
> </head>
>
>
> <body vlink="#FFFFCC" alink="#FFFF00" link="#FFFFFF">
>
> <div align="center">
> <table border="1" cellspacing="4" width="657" height="543"
> cellpadding="2"> <!-- MSTableType="layout" -->
> <tr>
> <td valign="top" colspan="2" height="74" bgcolor="#660066">
> <!-- MSCellType="ContentHead" -->
> <table border="1" cellpadding="0" cellspacing="0"
> style="border-collapse: collapse" width="100%" id="table8">
> <tr>
> <td>
> <p align="center"><font color="#FFFFFF" face="Verdana"><b>
> <img border="0" src="../images/users.gif" width="32"
> height="32"></b></font></td>
> <td>
> <p align="center"><font color="#FFFFFF"><b>USER
> MANAGER</b></font></td> <td>
> <p align="center"><font color="#FFFFFF" face="Verdana"><b>
> <img border="0" src="../images/key.gif" width="32"
> height="32"></b></font></td>
> </tr>
> </table>
> </td>
> </tr>
> <tr>
> <td msopnltype="NavBody" rowspan="2" width="113" valign="top"
> bgcolor="#660066">
> <!-- MSCellType="NavBody" -->
> <table border="1" cellpadding="0" cellspacing="0"
> style="border-collapse: collapse" width="100%" id="table7">
> <tr>
> <td align="center">
> <p align="center">
> <b><font size="2"><a
> href="javascript:history.back(1)">HOME</a></font></b></td>
> </tr>
> </table>
> </td>
> <td valign="top" height="419">
> <!-- MSCellType="ContentBody" -->
>
> <%
> 'here is the connection string
> Set conn = server.createobject("adodb.connection")
> 'this connection uses JET 4 it is the prefered method of connecting
> to an access database
> DSNtemp = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
> Server.Mappath("/asplogin/login.mdb")
> 'if you cant use JET then comment out the line above and uncomment
> the line below
> 'DSNtemp="DRIVER={Microsoft Access Driver (*.mdb)};DBQ=" &
> Server.Mappath("/asplogin/login.mdb")
> conn.Open DSNtemp
>
> SQL = "Select * from "& tbl
> pagetot = 10
>
> const adOpenForwardOnly = 0
> const adOpenKeySet = 1
> const adOpenDynamic = 2
> const adOpenStatic = 3
> const adLockReadOnly = 1
> const adLockPessimistic = 2
> const adLockOptimistic = 3
> const adLockBatchOptimistic = 4
> Set RS = Server.CreateObject("Adodb.RecordSet")
> RS.Open SQL, Conn, adopenkeyset, adlockoptimistic
> If RS.EOF Then
> %>
> <table cellspacing="1" border="0" cellpadding="2" width="100%">
> <tr>
> <td bgcolor="#CC0000">
> <p align="center">
> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
> <font color="#FFFFFF">Sorry, no records were found. </font> <a
> href="javascript:history.back(1)">Back To
> <%=ttl%> Manager</a> </font></td>
> </tr>
> </table>
> <font face="Verdana, Arial, Helvetica, sans-serif"><font size="2">
> <%
> ElseIf request("begin") = "" Then
> begin = 1
> Else
> begin = Cint(request("begin"))
> End If
>
> tot = ((begin+pagetot)-1)
>
> If tot > RS.RecordCount Then
> tot = RS.RecordCount
> End If
>
> i = 1
> navi = ""
> For j = 1 to RS.RecordCount step pagetot
> If j <> 1 Then navi = navi & " | "
> If j = Cint(begin) Then
> navi = navi & "<b>"&i&"</b>"
> Else
> navi = navi & "<a href="""
> navi = navi & Request.ServerVariables("url") & "?begin=" & j &
> "&which=" & tbl
> navi = navi & """>"
> navi = navi & i & "</a>"
> End If
> i = i + 1
> Next
> i = 1
> RS.Move begin - 1
> %> </font>
> <p align="center"><b><font size="4">Delete <%=ttl%></font></b></p>
> </font>
>
>
> <%
> For x = begin to begin + (pagetot - 1)
> If RS.EOF Then exit For
> %>
> <table border="1" cellpadding="0" cellspacing="0"
> style="border-collapse: collapse" width="100%" id="table1"
> bgcolor="#FFFFDD"> <tr>
> <td><font face="Verdana" size="2">User Name:</font></td>
> <td><font face="Verdana" size="2"><%=RS("uid")%></font></td>
> <td><font face="Verdana" size="2">Address:</font></td>
> <td><font face="Verdana" size="2"><%=RS("Address")%></font></td>
> </tr>
> <tr>
> <td><font face="Verdana" size="2">Password:</font></td>
> <td><font face="Verdana" size="2"><%=RS("pwd")%></font></td>
> <td><font face="Verdana" size="2">ZIP Code:</font></td>
> <td><font face="Verdana" size="2"><%=RS("ZIP")%></font></td>
> </tr>
> <tr>
> <td><font face="Verdana" size="2">First Name:</font></td>
> <td><font face="Verdana"
> size="2"><%=RS("FirstName")%></font></td> <td><font
> face="Verdana" size="2">City:</font></td> <td><font
> face="Verdana" size="2"><%=RS("City")%></font></td> </tr>
> <tr>
> <td><font face="Verdana" size="2">Last Name:</font></td>
> <td><font face="Verdana" size="2"><%=RS("LastName")%></font></td>
> <td><font face="Verdana" size="2">Country:</font></td>
> <td><font face="Verdana" size="2"><%=RS("Country")%></font></td>
> </tr>
> <tr>
> <td><font face="Verdana" size="2">Phone:</font></td>
> <td><font face="Verdana"
> size="2"><%=RS("PhoneNumber")%></font></td> <td><font
> face="Verdana" size="2">Mobile:</font></td> <td><font
> face="Verdana" size="2"><%=RS("MobileNumber")%></font></td> </tr>
> <tr>
> <td><font face="Verdana" size="2">Fax:</font></td>
> <td><font face="Verdana" size="2"><%=RS("Fax")%></font></td>
> <td><font face="Verdana" size="2">Notes:</font></td>
> <td><font face="Verdana" size="2"><%=RS("Notes")%></font></td>
> </tr>
> <tr>
> <td colspan="4">
> <p align="center">
> <a href="delete2.asp?which=<%=tbl%>&id=<%=RS("id")%>" >
> <img border="0" src="../images/btn_delete.gif" width="70"
> height="30"></a></td>
> </tr>
> <tr>
> <td colspan="4" bgcolor="#000000"> </td>
> </tr>
> </table>
> <%
> i = i + 1
> RS.MoveNext
> Next
> %>
> <table cellspacing="2" cellpadding="2" width="100%">
> <tr>
> <td align="right">
> <font face="Verdana, Arial, Helvetica, sans-serif" size="2">
> <b><%=ttl%> <%=begin%>
> - <%=tot%> of <%=RS.RecordCount%> Page:</b> <%=navi%> </font>
> </td>
> </tr>
> </table>
> <p> </p>
> <font size="2" face="Verdana, Arial, Helvetica, sans-serif"><%
> RS.Close
> Set RS = nothing
> Conn.close
> Set Conn = Nothing
> %> </font>
> </td>
> </tr>
> <tr>
> <td valign="top" height="50" width="544" bgcolor="#660066">
> <!-- MSCellType="ContentFoot" -->
> <p align="center"><font size="2" face="Verdana">
> </td>
> </tr>
> </table>
> </div>
>
> </body>
>
> </html>
> ************************************************** '''
> Thank you....
>
> /Goran
>
>
> ---
> Outgoing mail is certified Virus Free.
> Checked by AVG anti-virus system ([url]http://www.grisoft.com[/url]).
> Version: 6.0.524 / Virus Database: 321 - Release Date: 06.10.2003
Bob Barrows Guest
-
Ray at #4
Re: Please help with IF EOF TRUE
Cigarette?
"Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote> Aaarghh! Why all the irrelevant html garbage????
Ray at Guest
-
Bob Barrows #5
Re: Please help with IF EOF TRUE
:-)
No, thanks
Sorry Groan.
Bob
Ray at <%=sLocation%> wrote:> Cigarette?
>
> "Bob Barrows" <reb01501@NOyahoo.SPAMcom> wrote>> Aaarghh! Why all the irrelevant html garbage????
Bob Barrows Guest



Reply With Quote

