|
 |
asp_databases thread: Recordset paging
Message #1 by Bernadette Duffy <b.duffy@m...> on Tue, 29 Aug 2000 13:13:09 +0100
|
|
Cna anyone enlighten to as to what is wrong with the following code. Using
Record Set Paging
<% Response.ContentType = "text/vnd.wap.wml" %><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<%
Dim conn 'connection to database
dim rs 'recordset object
dim sqlQuery 'SQL Query
dim myarray 'String parsed into an array
dim fname 'First Name param
dim lname 'Last Name param
dim county
dim count
dim scounty
dim Sresult
dim intPage
dim intTotalPages
dim intRec
dim strScriptName
dim strQuote
strQuote =Chr(34)
Sresult = request("detail")
myarray =split(Sresult,".")
scounty=myarray(0)
lname=myarray(1)
fname=myarray(2)
count=1
Set conn = Server.CreateObject( "ADODB.Connection" )
Set rs = Server.CreateObject("ADODB.Recordset")
conn.Open "Bet"
rs.PageSize=10
rs.CursorLocation =3
%>
<card id="start" title="Results">
<onevent type="onenterforward">
<refresh>
</refresh>
</onevent>
<p>
<%
if fname<> "" and lname <>"" and scounty <> "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE County LIKE '" & scounty & "%' AND
Firstname LIKE '" & fname & "%'AND Lastname LIKE '" & lname & "%' "
end if
if lname<>"" and scounty<>"" and fname= "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE County LIKE '" & scounty & "%' AND
Lastname LIKE '" & lname & "%'"
end if
if lname<>"" and scounty= "" and fname<> "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE Firstname LIKE '" & fname & "%' AND
Lastname LIKE '" & lname & "%'"
end if
if lname<>"" and scounty= "" and fname= "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE Lastname LIKE '" & lname & "%'"
end if
if lname="" then
Response.Write ("Wrong Format.<br/>")
Response.Write ("Please try again.<br/>")
end if
if Sresult="" then
Response.Write ("Wrong Format.<br/>")
Response.Write ("Please try again.<br/>")
end if
if lname="" then
count=0
else
set rs = conn.Execute(sqlQuery)
if Request.QueryString ("PAGE")="" THEN
intPage=1
Else
if intPage<1 then
intPage=1
else
if intPage>rs.PageCount then
intPage=rs.PageCount
else
intPage=CInt(Request.QueryString ("PAGE"))
end if
end if
end if
'rs.Open sqlQuery,conn,adOpenForwardOnly ,adLockReadOnly ,adCmdTable
'rs.AbsolutePage =intPage
if rs.Eof then
Response.Write ("Sorry, No matches.<br/>")
Response.Write ("Please try again.<br/>")
else
For intRec=1 to rs.PageSize
if not rs.EOF then
Response.write(count & " ")
Response.Write(rs("Firstname")& " " &
rs("Lastname")& "<br/>")
Response.Write(rs("Address")& "<br/>")
Response.Write(rs("County")& "<br/>")
Response.Write(rs("Phone")& "<br/>" )
rs.MoveNext
count =count +1
end if
next
strScriptName= Request.ServerVariables ("SCRIPT_NAME")
Response.Write (strScriptName)
Response.Write " <a href= " & strQuote &strScriptName
&"?PAGE=1" & strQuote &">First Page</a>"
if intPage=1 then
Response.Write " <SPAN>Previuos Page</SPAN>"
else
Response.Write " <a href =" & strQuote & strScriptName
& "?PAGE ="& intPage -1 & strQuote & ">Previuos Page</a>"
end if
if intPage=rs.PageCount then
Response.Write " <SPAN>Next Page</SPAN>"
else
Response.Write " <a href =" & strQuote & strScriptName
& "?PAGE ="& intPage +1 & strQuote & ">Next Page</a>"
end if
Response.Write " <a href =" & strQuote & strScriptName &
"?PAGE=" & rs.PageCount &strQuote &">Last Page </a>"
rs.close
conn.Close
Set conn = Nothing
end if
end if
%>
<do type="Accept" label="Start">
<go href="details.asp"/></do>
</p>
</card>
</wml>
Message #2 by "James Q. Stansfield" <jstansfield@t...> on Tue, 29 Aug 2000 11:31:29 -0400
|
|
What kind of problem are you having with it?
-----Original Message-----
From: Bernadette Duffy [mailto:b.duffy@m...]
Sent: Tuesday, August 29, 2000 8:13 AM
To: ASP Databases
Subject: [asp_databases] Recordset paging
Cna anyone enlighten to as to what is wrong with the following code. Using
Record Set Paging
<% Response.ContentType = "text/vnd.wap.wml" %><?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN"
"http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<%
Dim conn 'connection to database
dim rs 'recordset object
dim sqlQuery 'SQL Query
dim myarray 'String parsed into an array
dim fname 'First Name param
dim lname 'Last Name param
dim county
dim count
dim scounty
dim Sresult
dim intPage
dim intTotalPages
dim intRec
dim strScriptName
dim strQuote
strQuote =Chr(34)
Sresult = request("detail")
myarray =split(Sresult,".")
scounty=myarray(0)
lname=myarray(1)
fname=myarray(2)
count=1
Set conn = Server.CreateObject( "ADODB.Connection" )
Set rs = Server.CreateObject("ADODB.Recordset")
conn.Open "Bet"
rs.PageSize=10
rs.CursorLocation =3
%>
<card id="start" title="Results">
<onevent type="onenterforward">
<refresh>
</refresh>
</onevent>
<p>
<%
if fname<> "" and lname <>"" and scounty <> "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE County LIKE '" & scounty & "%' AND
Firstname LIKE '" & fname & "%'AND Lastname LIKE '" & lname & "%' "
end if
if lname<>"" and scounty<>"" and fname= "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE County LIKE '" & scounty & "%' AND
Lastname LIKE '" & lname & "%'"
end if
if lname<>"" and scounty= "" and fname<> "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE Firstname LIKE '" & fname & "%' AND
Lastname LIKE '" & lname & "%'"
end if
if lname<>"" and scounty= "" and fname= "" then
sqlQuery = "SELECT * FROM bernie"
sqlQuery = sqlQuery & " WHERE Lastname LIKE '" & lname & "%'"
end if
if lname="" then
Response.Write ("Wrong Format.<br/>")
Response.Write ("Please try again.<br/>")
end if
if Sresult="" then
Response.Write ("Wrong Format.<br/>")
Response.Write ("Please try again.<br/>")
end if
if lname="" then
count=0
else
set rs = conn.Execute(sqlQuery)
if Request.QueryString ("PAGE")="" THEN
intPage=1
Else
if intPage<1 then
intPage=1
else
if intPage>rs.PageCount then
intPage=rs.PageCount
else
intPage=CInt(Request.QueryString ("PAGE"))
end if
end if
end if
'rs.Open sqlQuery,conn,adOpenForwardOnly ,adLockReadOnly ,adCmdTable
'rs.AbsolutePage =intPage
if rs.Eof then
Response.Write ("Sorry, No matches.<br/>")
Response.Write ("Please try again.<br/>")
else
For intRec=1 to rs.PageSize
if not rs.EOF then
Response.write(count & " ")
Response.Write(rs("Firstname")& " " &
rs("Lastname")& "<br/>")
Response.Write(rs("Address")& "<br/>")
Response.Write(rs("County")& "<br/>")
Response.Write(rs("Phone")& "<br/>" )
rs.MoveNext
count =count +1
end if
next
strScriptName= Request.ServerVariables ("SCRIPT_NAME")
Response.Write (strScriptName)
Response.Write " <a href= " & strQuote &strScriptName
&"?PAGE=1" & strQuote &">First Page</a>"
if intPage=1 then
Response.Write " <SPAN>Previuos Page</SPAN>"
else
Response.Write " <a href =" & strQuote & strScriptName
& "?PAGE ="& intPage -1 & strQuote & ">Previuos Page</a>"
end if
if intPage=rs.PageCount then
Response.Write " <SPAN>Next Page</SPAN>"
else
Response.Write " <a href =" & strQuote & strScriptName
& "?PAGE ="& intPage +1 & strQuote & ">Next Page</a>"
end if
Response.Write " <a href =" & strQuote & strScriptName &
"?PAGE=" & rs.PageCount &strQuote &">Last Page </a>"
rs.close
conn.Close
Set conn = Nothing
end if
end if
%>
<do type="Accept" label="Start">
<go href="details.asp"/></do>
</p>
</card>
</wml>
---
You are currently subscribed to asp_databases
Message #3 by stephenb@w... on Tue, 29 Aug 2000 17:58:32
|
|
In the first SELECT statement should LIKE '" & fname & "%'AND Lastname LIKE
have a space between %' and AND ? It doesn't appear to.
Message #4 by Bernadette Duffy <b.duffy@m...> on Wed, 30 Aug 2000 09:26:39 +0100
|
|
no the problem isn't with the select statement I thnk.It is with the
rs.Absolutepage. It tells me that the object or operator is not capable of
performing the requested operation.
-----Original Message-----
From: stephenb@w... [mailto:stephenb@w...]
Sent: Tuesday, August 29, 2000 6:59 PM
To: ASP Databases
Subject: [asp_databases] Re: Recordset paging
In the first SELECT statement should LIKE '" & fname & "%'AND Lastname LIKE
have a space between %' and AND ? It doesn't appear to.
---
You are currently subscribed to asp_databases
|
|
 |