|
 |
asp_web_howto thread: SOS ,its urgent please
Message #1 by nusrat sarwar <nusratsarwar@y...> on Sat, 13 Apr 2002 07:36:11 -0700 (PDT)
|
|
Hello dear friends
Hope all of you are fine
I have a problem with the ciode given below and I have
to correct it by sunday, please I will be thankful for
yr help
the cod was working fine
getting data pagingrecordset but now it has stoped and
on every attempt it is showing error "NO DATA FOUND"
why it has stoped getting records?
code:
<%
Dim CONN_STRING
Dim CONN_USER
Dim CONN_PASS
CONN_USER = ""
CONN_PASS = ""
CONN_STRING = Application("SQLConnString")
CONN_USER = Application("SQLUsername")
CONN_PASS = Application("SQLPassword")
Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strOrderBy
Dim strSQL
Dim objPagingConn
Dim objPagingRS
Dim iRecordsShown
Dim I
Session("lttrs")=request.form("lttrs")
iPageSize = 10
' Retrieve page to show or default to 1
If Request.QueryString("page") = "" Then
iPageCurrent = 1
Else iPageCurrent = CInt(Request.QueryString("page"))
End If
' Read in order or default to id
if Request.Form("lttrs")<>"" then
qs2=Request.Form("lttrs")
elseif Request.QueryString("qs2")<>"" then
qs2=Request.QueryString("qs2")
end if
strSQL ="SELECT BABYNAME,MEANING FROM babynames where
babycat='female' and BABYNAME like '"&qs2&"%' ORDER BY
babyname asc"
idfield="babyname"
scriptresponder="viewdesc.asp"
Set objPagingConn
Server.CreateObject("ADODB.Connection")
objPagingConn.Open "DBQ=" &
Server.Mappath("babynames.mdb") & ";Driver={Microsoft
Access Driver (*.mdb)};"
Set objPagingRS
Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize = iPageSize
objPagingRS.CacheSize = iPageSize
objPagingRS.Open strSQL , objPagingConn ,
adOpenStatic, adLockReadOnly , adCmdText
iPageCount = objPagingRS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent
iPageCount
If iPageCurrent < 1 Then iPageCurrent = 1
If iPageCount = 0 Then
Response.Write "No records found!"
Else
objPagingRS.AbsolutePage = iPageCurrent
%>
<font size="+1"> Page <b> <%
iPageCurrent
%> </b> of <b> <%= iPageCount
%> </b> </font>
<%
Response.Write "<BR><BR>" & vbCrLf
' Continue with a title row in our table
%>
<table width="58%" border="0"
cellspacing="0" cellpadding="0" height="20">
<tr>
<td bgcolor="#6666cc"
width="11%">
<div align="center"></div>
</td>
<td bgcolor="#6666cc"
width="17%">
<div align="left"><font
color="#FFFFFF"><b><font face="Arial, Helvetica,
sans-serif">Name </font></b></font></div>
</td>
<td bgcolor="#6666cc"
width="72%">
<div align="left"><font
color="#FFFFFF"><b><font face="Arial, Helvetica,
sans-serif">Meaning </font></b></font></div>
</td>
</tr>
</table>
<%
Response.Write "<TABLE BORDER=""1"" cellpadding=""0""
cellspacing=""0"" width=""350"" bgcolor=#e1f0e1
bordercolor=#3820ae>" & vbCrLf
' Show field names in the top row
'Response.Write vbTab & "<TR>" & vbCrLf
howmanyfields=objPagingRS.Fields.Count - 1
For I = 0 To howmanyfields
'Response.Write vbTab & vbTab & "<TD
bgcolor=#6666cc><B>"
'Response.Write "<font color=white>"
'Response.Write objPagingRS.Fields(I).Name
'Response.Write"</font>"
'Response.Write "<B></TD>" & vbCrLf
Next 'I
'Response.Write vbTab & "</TR>" & vbCrLf
' Loop through our records and ouput 1 row per record
iRecordsShown = 0
Do While iRecordsShown < iPageSize And Not
objPagingRS.EOF
Response.Write vbTab & "<TR>" & vbCrLf
'For I = 0 To objPagingRS.Fields.Count - 1
Response.Write vbTab & vbTab & "<TD>"
my_link=scriptresponder & "?which=" &
objPagingRS(idfield)
Response.write "<a HREF=" & my_link & ">View </a>"
for I = 0 to howmanyfields
Response.Write vbTab & vbTab & "<TD>"
Response.Write objPagingRS(I)
'Response.Write objPagingRS.Fields(I)
Response.Write "</TD>" & vbCrLf
Next 'I
Response.Write vbTab & "</TR>" & vbCrLf
' Increment the number of records we've shown
iRecordsShown = iRecordsShown + 1 ' Can't forget to
move to the next record!
objPagingRS.MoveNext
Loop ' All done - close table
Response.Write "</TABLE>" & vbCrLf
End If
If iPageCurrent <> 1 Then
%>
<a href="./girls.asp?page=<%
iPageCurrent - 1 %>&qs2=<%= Server.URLEncode(qs2)
%>">Previous</a>
<%
' Above spacing is inside the If so we don't get it
unless needed
End If
If iPageCurrent < iPageCount Then
%>
<a href="./girls.asp?page=<%
iPageCurrent + 1 %>&qs2=<%= Server.URLEncode(qs2)
%>">Next</a>
<% end if %>
</div>
</TD>
</TR>
</TBODY>
</TABLE>
I know I am overlooking something, please do help as
quick as possible
I'll be very grateful
many thanx
take care
regards
nusrat
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
Message #2 by "MARTHA J SAYERS" <msayers@c...> on Sat, 13 Apr 2002 10:53:35 -0700
|
|
are there any records that meet the criteria ??
Message #3 by "Drew, Ron" <RDrew@B...> on Sat, 13 Apr 2002 18:09:57 -0400
|
|
If Request.Form("lttrs")<>"" qs2 does not get set to anything. I added 3
lines of code below. Try running it.
For debugging use Response.write
-----Original Message-----
From: nusrat sarwar [mailto:nusratsarwar@y...]
Sent: Saturday, April 13, 2002 10:36 AM
To: ASP Web HowTo
Subject: [asp_web_howto] SOS ,its urgent please
Hello dear friends
Hope all of you are fine
I have a problem with the ciode given below and I have
to correct it by sunday, please I will be thankful for
yr help
the cod was working fine
getting data pagingrecordset but now it has stoped and
on every attempt it is showing error "NO DATA FOUND"
why it has stoped getting records?
code:
<%
Dim CONN_STRING
Dim CONN_USER
Dim CONN_PASS
CONN_USER =3D ""
CONN_PASS =3D ""
CONN_STRING =3D Application("SQLConnString")
CONN_USER =3D Application("SQLUsername")
CONN_PASS =3D Application("SQLPassword")
Dim iPageSize
Dim iPageCount
Dim iPageCurrent
Dim strOrderBy
Dim strSQL
Dim objPagingConn
Dim objPagingRS
Dim iRecordsShown
Dim I
Session("lttrs")=3Drequest.form("lttrs")
iPageSize =3D 10
' Retrieve page to show or default to 1
If Request.QueryString("page") =3D "" Then
iPageCurrent =3D 1
Else iPageCurrent =3D CInt(Request.QueryString("page"))
End If
' Read in order or default to id
if Request.Form("lttrs")<>"" then
qs2=3DRequest.Form("lttrs")
elseif Request.QueryString("qs2")<>"" then
qs2=3DRequest.QueryString("qs2")
end if
strSQL =3D"SELECT BABYNAME,MEANING FROM babynames where
babycat=3D'female'
and BABYNAME like '"&qs2&"%' ORDER BY
babyname asc"
...................................<<<<<<<<<<<<<< look here
response.write Request.Form("lttrs") & "=3Dlttrs"
response.write Request.QueryString("qs2") & "=3Dqs2"
response.write strSQL
...................................<<<<<<<<<<<<<< look here
idfield=3D"babyname"
scriptresponder=3D"viewdesc.asp"
Set objPagingConn =3D
Server.CreateObject("ADODB.Connection")
objPagingConn.Open "DBQ=3D" &
Server.Mappath("babynames.mdb") & ";Driver=3D{Microsoft
Access Driver (*.mdb)};"
Set objPagingRS =3D
Server.CreateObject("ADODB.Recordset")
objPagingRS.PageSize =3D iPageSize
objPagingRS.CacheSize =3D iPageSize
objPagingRS.Open strSQL , objPagingConn ,
adOpenStatic, adLockReadOnly , adCmdText
iPageCount =3D objPagingRS.PageCount
If iPageCurrent > iPageCount Then iPageCurrent =3D
iPageCount
If iPageCurrent < 1 Then iPageCurrent =3D 1
If iPageCount =3D 0 Then=09
Response.Write "No records found!"
Else
objPagingRS.AbsolutePage =3D iPageCurrent
%>
<font size=3D"+1"> Page <b> <%=3D iPageCurrent
%> </b> of <b> <%=3D iPageCount
%> </b> </font>
<%
Response.Write "<BR><BR>" & vbCrLf
' Continue with a title row in our table
%>
<table width=3D"58%" border=3D"0" cellspacing=3D"0"
cellpadding=3D"0" height=3D"20">
<tr>
<td bgcolor=3D"#6666cc"
width=3D"11%">
<div align=3D"center"></div>
</td>
<td bgcolor=3D"#6666cc"
width=3D"17%">
<div align=3D"left"><font
color=3D"#FFFFFF"><b><font face=3D"Arial, Helvetica,
sans-serif">Name </font></b></font></div>
</td>
<td bgcolor=3D"#6666cc"
width=3D"72%">
<div align=3D"left"><font
color=3D"#FFFFFF"><b><font face=3D"Arial, Helvetica,
sans-serif">Meaning </font></b></font></div>
</td>
</tr>
</table>
<%
Response.Write "<TABLE BORDER=3D""1"" cellpadding=3D""0""
cellspacing=3D""0""
width=3D""350"" bgcolor=3D#e1f0e1 bordercolor=3D#3820ae>" & vbCrLf '
Show
field names in the top row 'Response.Write vbTab & "<TR>" & vbCrLf
howmanyfields=3DobjPagingRS.Fields.Count - 1 For I =3D 0 To
howmanyfields
'Response.Write vbTab & vbTab & "<TD
bgcolor=3D#6666cc><B>"
'Response.Write "<font color=3Dwhite>"
'Response.Write objPagingRS.Fields(I).Name
'Response.Write"</font>"
'Response.Write "<B></TD>" & vbCrLf
Next 'I
'Response.Write vbTab & "</TR>" & vbCrLf
' Loop through our records and ouput 1 row per record
iRecordsShown =3D 0
Do While iRecordsShown < iPageSize And Not
objPagingRS.EOF
Response.Write vbTab & "<TR>" & vbCrLf
'For I =3D 0 To objPagingRS.Fields.Count - 1
Response.Write vbTab & vbTab & "<TD>"
my_link=3Dscriptresponder & "?which=3D" &
objPagingRS(idfield)
Response.write "<a HREF=3D" & my_link & ">View </a>"
for I =3D 0 to howmanyfields
Response.Write vbTab & vbTab & "<TD>"
Response.Write objPagingRS(I)
'Response.Write objPagingRS.Fields(I)
Response.Write "</TD>" & vbCrLf
Next 'I
Response.Write vbTab & "</TR>" & vbCrLf
' Increment the number of records we've shown
iRecordsShown =3D iRecordsShown + 1 ' Can't forget to
move to the next record!
objPagingRS.MoveNext
Loop ' All done - close table
Response.Write "</TABLE>" & vbCrLf
End If
If iPageCurrent <> 1 Then
%>
<a href=3D"./girls.asp?page=3D<%=3D
iPageCurrent - 1 %>&qs2=3D<%=3D Server.URLEncode(qs2) %>">Previous</a>
<%
' Above spacing is inside the If so we don't get it
unless needed
End If
If iPageCurrent < iPageCount Then
%>
<a href=3D"./girls.asp?page=3D<%=3D
iPageCurrent + 1 %>&qs2=3D<%=3D Server.URLEncode(qs2)
%>">Next</a>
<% end if %>
</div>
</TD>
</TR>
</TBODY>
</TABLE>
I know I am overlooking something, please do help as
quick as possible
I'll be very grateful
many thanx
take care
regards
nusrat
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax http://taxes.yahoo.com/
---
Improve your web design skills with these new books from Glasshaus.
Usable Web Menus
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/theprogramm
e
r-20
Constructing Accessible Web Sites
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/theprogramm
e
r-20
Practical JavaScript for the Usable Web
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/theprogramm
e
r-20
Message #4 by nusrat sarwar <nusratsarwar@y...> on Sat, 13 Apr 2002 19:11:43 -0700 (PDT)
|
|
Hello Ron
oh how can I thank you for yr quick response
and I am certain it will solve my problem as before
many many many thanx
I have just got yr mail and now I will try it
God bless you!
happy weekend
take good care
regards
nusrat
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
Message #5 by nusrat sarwar <nusratsarwar@y...> on Sat, 13 Apr 2002 19:14:21 -0700 (PDT)
|
|
Yes dear Martha there are many records that meet the
criteria
many thanx
regards
nusrat
--- MARTHA J SAYERS <msayers@c...> wrote:
> are there any records that meet the criteria ??
>
>
>
>
> ---
>
> Improve your web design skills with these new books
> from Glasshaus.
>
> Usable Web Menus
>
http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=nosim/theprogramme
> r-20
> Constructing Accessible Web Sites
>
http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=nosim/theprogramme
> r-20
> Practical JavaScript for the Usable Web
>
http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=nosim/theprogramme
> r-20
__________________________________________________
Do You Yahoo!?
Yahoo! Tax Center - online filing with TurboTax
http://taxes.yahoo.com/
|
|
 |