Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: record paging


Message #1 by sridarti@s... on Sun, 9 Dec 2001 04:57:56
I have tried doing record paging...with the example below..below is part 

of the codes..my qs is, when i tried to insert a StrSQL before the line



rs.Open sqrSQl, conn, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect



it does not work...but if i take out the strSQL statement and just simple



rs.Open "table name", conn, adOpenForwardOnly, adLockReadOnly, 

adCmdTableDirect





it works...why is it so?? is there no other way where i can record paging 

with a select statement? this being i do not want to display everything 

thats in teh DB....















<% 



' ADO constants used in this page

Const adOpenForwardOnly = 0

Const adLockReadOnly = 1

Const adCmdTableDirect = &H0200

Const adUseClient = 3

%>

<html>

<head>

	<style>

	body { font-family : Verdana; font-size : 8pt; }

	a { font-family : Verdana; font-size : 8pt; text-decoration : 

none; }

	</style>

</head>



<body>



<%

	

		Set rs = Server.CreateObject("ADODB.Recordset")

		

		rs.PageSize = 10

		rs.CacheSize = 10

		rs.CursorLocation = adUseClient

		

strSQL = " ......." 

		

		rs.Open "view_orders", conn, adOpenForwardOnly, 

adLockReadOnly, adCmdTableDirect

		

		







thank you...
Message #2 by "Kim Iwan Hansen" <kimiwan@k...> on Sun, 9 Dec 2001 07:35:33 +0100
when you use a sql string, use adCmdText in place of adCmdTableDirect



-Kim



-----Original Message-----

From: sridarti@s... [mailto:sridarti@s...]

Sent: 9. december 2001 04:58

To: ASP Databases

Subject: [asp_databases] record paging





I have tried doing record paging...with the example below..below is part

of the codes..my qs is, when i tried to insert a StrSQL before the line



rs.Open sqrSQl, conn, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect



it does not work...but if i take out the strSQL statement and just simple



rs.Open "table name", conn, adOpenForwardOnly, adLockReadOnly,

adCmdTableDirect





it works...why is it so?? is there no other way where i can record paging

with a select statement? this being i do not want to display everything

thats in teh DB....















<%



' ADO constants used in this page

Const adOpenForwardOnly = 0

Const adLockReadOnly = 1

Const adCmdTableDirect = &H0200

Const adUseClient = 3

%>

<html>

<head>

	<style>

	body { font-family : Verdana; font-size : 8pt; }

	a { font-family : Verdana; font-size : 8pt; text-decoration :

none; }

	</style>

</head>



<body>



<%



		Set rs = Server.CreateObject("ADODB.Recordset")



		rs.PageSize = 10

		rs.CacheSize = 10

		rs.CursorLocation = adUseClient



strSQL = " ......."



		rs.Open "view_orders", conn, adOpenForwardOnly,

adLockReadOnly, adCmdTableDirect











thank you...




$subst('Email.Unsub').



Message #3 by "Ken Schaefer" <ken@a...> on Sun, 9 Dec 2001 16:08:41 +1100
If you use an SQL statement you need to use adCmdText as the CommandTypeEnum

Option, not adCmdTableDirect.



adCmdTableDirect means that the first parameter is a table name

adCmdText means that the first parameter is a text string (ie SQL) that the

database will process



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: <sridarti@s...>

Subject: [asp_databases] record paging





: I have tried doing record paging...with the example below..below is part

: of the codes..my qs is, when i tried to insert a StrSQL before the line

:

: rs.Open sqrSQl, conn, adOpenForwardOnly, adLockReadOnly, adCmdTableDirect

:

: it does not work...but if i take out the strSQL statement and just simple

:

: rs.Open "table name", conn, adOpenForwardOnly, adLockReadOnly,

: adCmdTableDirect

:

:

: it works...why is it so?? is there no other way where i can record paging

: with a select statement? this being i do not want to display everything

: thats in teh DB....



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~



Message #4 by "Sridarti Herryanto" <sridarti@s...> on Sun, 9 Dec 2001 15:30:35 +0800
Hi,



I have change the adCmdText, after testing, i can only view the table header

instead of togehter with the records...why issit so? i had not change

anything else...whihc was previously functionable.



sri









----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Sunday, December 09, 2001 1:08 PM

Subject: [asp_databases] Re: record paging





> If you use an SQL statement you need to use adCmdText as the

CommandTypeEnum

> Option, not adCmdTableDirect.

>

> adCmdTableDirect means that the first parameter is a table name

> adCmdText means that the first parameter is a text string (ie SQL) that

the

> database will process

>

> Cheers

> Ken

>

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> From: <sridarti@s...>

> Subject: [asp_databases] record paging

>

>

> : I have tried doing record paging...with the example below..below is part

> : of the codes..my qs is, when i tried to insert a StrSQL before the line

> :

> : rs.Open sqrSQl, conn, adOpenForwardOnly, adLockReadOnly,

adCmdTableDirect

> :

> : it does not work...but if i take out the strSQL statement and just

simple

> :

> : rs.Open "table name", conn, adOpenForwardOnly, adLockReadOnly,

> : adCmdTableDirect

> :

> :

> : it works...why is it so?? is there no other way where i can record

paging

> : with a select statement? this being i do not want to display everything

> : thats in teh DB....

>

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>

>




$subst('Email.Unsub').



Message #5 by "Kim Iwan Hansen" <kimiwan@k...> on Sun, 9 Dec 2001 19:31:58 +0100
what does your sql string look like?



what does your code to print the recordset to the screen look like?



-Kim



-----Original Message-----

From: Sridarti Herryanto [mailto:sridarti@s...]

Sent: 9. december 2001 08:31

To: ASP Databases

Subject: [asp_databases] Re: record paging





Hi,



I have change the adCmdText, after testing, i can only view the table header

instead of togehter with the records...why issit so? i had not change

anything else...whihc was previously functionable.



sri









----- Original Message -----

From: "Ken Schaefer" <ken@a...>

To: "ASP Databases" <asp_databases@p...>

Sent: Sunday, December 09, 2001 1:08 PM

Subject: [asp_databases] Re: record paging





> If you use an SQL statement you need to use adCmdText as the

CommandTypeEnum

> Option, not adCmdTableDirect.

>

> adCmdTableDirect means that the first parameter is a table name

> adCmdText means that the first parameter is a text string (ie SQL) that

the

> database will process

>

> Cheers

> Ken

>

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> From: <sridarti@s...>

> Subject: [asp_databases] record paging

>

>

> : I have tried doing record paging...with the example below..below is part

> : of the codes..my qs is, when i tried to insert a StrSQL before the line

> :

> : rs.Open sqrSQl, conn, adOpenForwardOnly, adLockReadOnly,

adCmdTableDirect

> :

> : it does not work...but if i take out the strSQL statement and just

simple

> :

> : rs.Open "table name", conn, adOpenForwardOnly, adLockReadOnly,

> : adCmdTableDirect

> :

> :

> : it works...why is it so?? is there no other way where i can record

paging

> : with a select statement? this being i do not want to display everything

> : thats in teh DB....

>

> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

>

>




$subst('Email.Unsub').








$subst('Email.Unsub').



Message #6 by sridarti <sridarti@s...> on Mon, 10 Dec 2001 15:27:49 +0800 (SGT)
Hi Kim,

my codes to the sql and the print out of the table is as 

follows...

Thank you....





<% 



' ADO constants used in this page

Const adOpenForwardOnly = 0

Const adLockReadOnly = 1

Const adCmdText  = &H0200

Const adUseClient = 3

%>

<html>

<head>

	<style>

	body { font-family : Verdana; font-size : 8pt; }

	a { font-family : Verdana; font-size : 8pt; text-

decoration : none; }

	</style>

</head>



<body>



<%

	

		Set rs = Server.CreateObject

("ADODB.Recordset")

		

		rs.PageSize = 10

		rs.CacheSize = 10

		rs.CursorLocation = adUseClient

		

		strSQL = "SELECT o.keyid, o.orderid, 

o.orderrefno, o.custrefno, o.custkeyid, "_

		& "c.custid, c.custname, o.contactperson, 

o.ordermethod, sys1.codedesc AS ordermethod_desc, "_

		& "o.ordertype, sys2.codedesc AS 

ordertype_desc, o.orderdate, o.status, "_

		& "sys3.codedesc AS status_desc "_

		& "FROM (((orders AS o INNER JOIN customer 

AS c ON o.custkeyid=c.keyid) "_

		& "INNER JOIN codes_system AS sys1 ON 

o.ordermethod=sys1.keyid) "_

		& "INNER JOIN codes_system AS sys2 ON 

o.ordertype=sys2.codeid) "_

		& "INNER JOIN codes_system AS sys3 ON 

o.status=sys3.codeid "_

		& "WHERE (((o.custkeyid)=c.keyid) And 

((o.ordermethod)=sys1.keyid) "_

		& "And ((o.ordertype)=sys2.codeid) And 

((o.status)=sys3.codeid))"



		

		rs.Open strSQL, conn,adOpenForwardOnly, 

adLockReadOnly, adCmdText 

		

		

		If Len(Request("pagenum")) = 0  Then

				rs.AbsolutePage = 1

			Else

				If CInt(Request("pagenum")) 

<= rs.PageCount Then

					

	rs.AbsolutePage = Request("pagenum")

					Else

					

	rs.AbsolutePage = 1

				End If

		End If

		

		Dim abspage, pagecnt

			abspage = rs.AbsolutePage

			pagecnt = rs.PageCount

		

		If Not rs.EOF Then

			Response.Write "PageCount : " & 

rs.PageCount & "<br>" & vbcrlf

			'Response.Write "Absolute Page : " 

& rs.AbsolutePage & "<br>" & vbcrlf

			

				Response.Write "Total 

number of records : " & rs.RecordCount & "<br><br>" & vbcrlf

				

				Dim fldF, intRec

				

				

				Response.Write "<table 

border=1 align=center cellpadding=1 cellspacing=0 

><thead><tr>"

				

				For Each fldF in rs.Fields

				

	Response.Write "<td>" & fldF.Name & "</td>"

				Next

			

	Response.Write "</tr></thead><tbody>"

				

				For intRec=1 To rs.PageSize

					If Not rs.EOF Then

					

	Response.Write "<tr>"

						For Each 

fldF in rs.Fields

						

	Response.Write "<td>" & fldF.Value & "</td>"

						Next

					

	Response.Write "<tr>"

						rs.MoveNext

					End If

				Next

			

	Response.Write "</tbody></table><p>"

			

				

				' Now showing first, next, 

back, last buttons.

				Response.Write "<div 

align=""center"">" & vbcrlf

				Response.Write "<a href=""" 

& Request.ServerVariables("SCRIPT_NAME") & "?

pagenum=1"">First Page</a>"

			

	Response.Write "&nbsp;|&nbsp;"

				

				If abspage = 1 Then

				Response.Write "<span 

style=""color:silver;"">Previous Page</span>"

				Else

				Response.Write "<a href=""" 

& Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & 

abspage - 1 & """>Previous Page</a>"

				End If

				

			

	Response.Write "&nbsp;|&nbsp;"

				

				If abspage < pagecnt Then

				Response.Write "<a href=""" 

& Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & 

abspage + 1 & """>Next Page</a>"

				Else

				Response.Write "<span 

style=""color:silver;"">Next Page</span>"

				End If

			

	Response.Write "&nbsp;|&nbsp;"

				Response.Write "<a href=""" 

& Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" & 

pagecnt & """>Last Page</a>"

				Response.Write "</div>" & 

vbcrlf

				

		Else

			Response.Write "No records found!"

		End If

						

		rs.Close

		Set rs = Nothing

%>

</body>

</html>







Kim Iwan Hansen <kimiwan@k...> wrote:



> what does your sql string look like?

> 

> what does your code to print the recordset to the screen 

look

> like?

> 

> -Kim

> 

> -----Original Message-----

> From: Sridarti Herryanto [mailto:sridarti@s...]

> Sent: 9. december 2001 08:31

> To: ASP Databases

> Subject: [asp_databases] Re: record paging

> 

> 

> Hi,

> 

> I have change the adCmdText, after testing, i can only 

view the

> table header

> instead of togehter with the records...why issit so? i 

had not

> change

> anything else...whihc was previously functionable.

> 

> sri

> 

> 

> 

> 

> ----- Original Message -----

> From: "Ken Schaefer" <ken@a...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Sunday, December 09, 2001 1:08 PM

> Subject: [asp_databases] Re: record paging

> 

> 

> > If you use an SQL statement you need to use adCmdText 

as the

> CommandTypeEnum

> > Option, not adCmdTableDirect.

> >

> > adCmdTableDirect means that the first parameter is a 

table name

> > adCmdText means that the first parameter is a text 

string (ie SQL)

> that

> the

> > database will process

> >

> > Cheers

> > Ken

> >

> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> > From: <sridarti@s...>

> > Subject: [asp_databases] record paging

> >

> >

> > : I have tried doing record paging...with the example 

below..below

> is part

> > : of the codes..my qs is, when i tried to insert a 

StrSQL before

> the line

> > :

> > : rs.Open sqrSQl, conn, adOpenForwardOnly, 

adLockReadOnly,

> adCmdTableDirect

> > :

> > : it does not work...but if i take out the strSQL 

statement and

> just

> simple

> > :

> > : rs.Open "table name", conn, adOpenForwardOnly, 

adLockReadOnly,

> > : adCmdTableDirect

> > :

> > :

> > : it works...why is it so?? is there no other way where 

i can

> record

> paging

> > : with a select statement? this being i do not want to 

display

> everything

> > : thats in teh DB....

> >

> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> >

> >





> $subst('Email.Unsub').

> 

> 





> $subst('Email.Unsub').

> 

> 





> $subst('Email.Unsub').

> 

Message #7 by "Kim Iwan Hansen" <kimiwan@k...> on Mon, 10 Dec 2001 17:59:24 +0100
have you tested your sql string in the query analyzer to see that it

actually does contain data?



-Kim



-----Original Message-----

From: sridarti [mailto:sridarti@s...]

Sent: 10. december 2001 08:28

To: ASP Databases

Subject: [asp_databases] Re: record paging





Hi Kim,

my codes to the sql and the print out of the table is as

follows...

Thank you....





<%



' ADO constants used in this page

Const adOpenForwardOnly = 0

Const adLockReadOnly = 1

Const adCmdText  = &H0200

Const adUseClient = 3

%>

<html>

<head>

	<style>

	body { font-family : Verdana; font-size : 8pt; }

	a { font-family : Verdana; font-size : 8pt; text-

decoration : none; }

	</style>

</head>



<body>



<%



		Set rs = Server.CreateObject

("ADODB.Recordset")



		rs.PageSize = 10

		rs.CacheSize = 10

		rs.CursorLocation = adUseClient



		strSQL = "SELECT o.keyid, o.orderid,

o.orderrefno, o.custrefno, o.custkeyid, "_

		& "c.custid, c.custname, o.contactperson,

o.ordermethod, sys1.codedesc AS ordermethod_desc, "_

		& "o.ordertype, sys2.codedesc AS

ordertype_desc, o.orderdate, o.status, "_

		& "sys3.codedesc AS status_desc "_

		& "FROM (((orders AS o INNER JOIN customer

AS c ON o.custkeyid=c.keyid) "_

		& "INNER JOIN codes_system AS sys1 ON

o.ordermethod=sys1.keyid) "_

		& "INNER JOIN codes_system AS sys2 ON

o.ordertype=sys2.codeid) "_

		& "INNER JOIN codes_system AS sys3 ON

o.status=sys3.codeid "_

		& "WHERE (((o.custkeyid)=c.keyid) And

((o.ordermethod)=sys1.keyid) "_

		& "And ((o.ordertype)=sys2.codeid) And

((o.status)=sys3.codeid))"





		rs.Open strSQL, conn,adOpenForwardOnly,

adLockReadOnly, adCmdText





		If Len(Request("pagenum")) = 0  Then

				rs.AbsolutePage = 1

			Else

				If CInt(Request("pagenum"))

<= rs.PageCount Then



	rs.AbsolutePage = Request("pagenum")

					Else



	rs.AbsolutePage = 1

				End If

		End If



		Dim abspage, pagecnt

			abspage = rs.AbsolutePage

			pagecnt = rs.PageCount



		If Not rs.EOF Then

			Response.Write "PageCount : " &

rs.PageCount & "<br>" & vbcrlf

			'Response.Write "Absolute Page : "

& rs.AbsolutePage & "<br>" & vbcrlf



				Response.Write "Total

number of records : " & rs.RecordCount & "<br><br>" & vbcrlf



				Dim fldF, intRec





				Response.Write "<table

border=1 align=center cellpadding=1 cellspacing=0

><thead><tr>"



				For Each fldF in rs.Fields



	Response.Write "<td>" & fldF.Name & "</td>"

				Next



	Response.Write "</tr></thead><tbody>"



				For intRec=1 To rs.PageSize

					If Not rs.EOF Then



	Response.Write "<tr>"

						For Each

fldF in rs.Fields



	Response.Write "<td>" & fldF.Value & "</td>"

						Next



	Response.Write "<tr>"

						rs.MoveNext

					End If

				Next



	Response.Write "</tbody></table><p>"





				' Now showing first, next,

back, last buttons.

				Response.Write "<div

align=""center"">" & vbcrlf

				Response.Write "<a href="""

& Request.ServerVariables("SCRIPT_NAME") & "?

pagenum=1"">First Page</a>"



	Response.Write "&nbsp;|&nbsp;"



				If abspage = 1 Then

				Response.Write "<span

style=""color:silver;"">Previous Page</span>"

				Else

				Response.Write "<a href="""

& Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" &

abspage - 1 & """>Previous Page</a>"

				End If





	Response.Write "&nbsp;|&nbsp;"



				If abspage < pagecnt Then

				Response.Write "<a href="""

& Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" &

abspage + 1 & """>Next Page</a>"

				Else

				Response.Write "<span

style=""color:silver;"">Next Page</span>"

				End If



	Response.Write "&nbsp;|&nbsp;"

				Response.Write "<a href="""

& Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" &

pagecnt & """>Last Page</a>"

				Response.Write "</div>" &

vbcrlf



		Else

			Response.Write "No records found!"

		End If



		rs.Close

		Set rs = Nothing

%>

</body>

</html>







Kim Iwan Hansen <kimiwan@k...> wrote:



> what does your sql string look like?

>

> what does your code to print the recordset to the screen

look

> like?

>

> -Kim

>

> -----Original Message-----

> From: Sridarti Herryanto [mailto:sridarti@s...]

> Sent: 9. december 2001 08:31

> To: ASP Databases

> Subject: [asp_databases] Re: record paging

>

>

> Hi,

>

> I have change the adCmdText, after testing, i can only

view the

> table header

> instead of togehter with the records...why issit so? i

had not

> change

> anything else...whihc was previously functionable.

>

> sri

>

>

>

>

> ----- Original Message -----

> From: "Ken Schaefer" <ken@a...>

> To: "ASP Databases" <asp_databases@p...>

> Sent: Sunday, December 09, 2001 1:08 PM

> Subject: [asp_databases] Re: record paging

>

>

> > If you use an SQL statement you need to use adCmdText

as the

> CommandTypeEnum

> > Option, not adCmdTableDirect.

> >

> > adCmdTableDirect means that the first parameter is a

table name

> > adCmdText means that the first parameter is a text

string (ie SQL)

> that

> the

> > database will process

> >

> > Cheers

> > Ken

> >

> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> > From: <sridarti@s...>

> > Subject: [asp_databases] record paging

> >

> >

> > : I have tried doing record paging...with the example

below..below

> is part

> > : of the codes..my qs is, when i tried to insert a

StrSQL before

> the line

> > :

> > : rs.Open sqrSQl, conn, adOpenForwardOnly,

adLockReadOnly,

> adCmdTableDirect

> > :

> > : it does not work...but if i take out the strSQL

statement and

> just

> simple

> > :

> > : rs.Open "table name", conn, adOpenForwardOnly,

adLockReadOnly,

> > : adCmdTableDirect

> > :

> > :

> > : it works...why is it so?? is there no other way where

i can

> record

> paging

> > : with a select statement? this being i do not want to

display

> everything

> > : thats in teh DB....

> >

> > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> >

> >





> $subst('Email.Unsub').

>

>





> $subst('Email.Unsub').

>

>





> $subst('Email.Unsub').

>






$subst('Email.Unsub').



Message #8 by "Sridarti Herryanto" <sridarti@s...> on Thu, 13 Dec 2001 22:38:51 +0800
Hi Kim, yes i have tested and it does contains data inside my query.....





sri





----- Original Message -----

From: "Kim Iwan Hansen" <kimiwan@k...>

To: "ASP Databases" <asp_databases@p...>

Sent: Tuesday, December 11, 2001 12:59 AM

Subject: [asp_databases] Re: record paging





> have you tested your sql string in the query analyzer to see that it

> actually does contain data?

>

> -Kim

>

> -----Original Message-----

> From: sridarti [mailto:sridarti@s...]

> Sent: 10. december 2001 08:28

> To: ASP Databases

> Subject: [asp_databases] Re: record paging

>

>

> Hi Kim,

> my codes to the sql and the print out of the table is as

> follows...

> Thank you....

>

>

> <%

>

> ' ADO constants used in this page

> Const adOpenForwardOnly = 0

> Const adLockReadOnly = 1

> Const adCmdText  = &H0200

> Const adUseClient = 3

> %>

> <html>

> <head>

> <style>

> body { font-family : Verdana; font-size : 8pt; }

> a { font-family : Verdana; font-size : 8pt; text-

> decoration : none; }

> </style>

> </head>

>

> <body>

>

> <%

>

> Set rs = Server.CreateObject

> ("ADODB.Recordset")

>

> rs.PageSize = 10

> rs.CacheSize = 10

> rs.CursorLocation = adUseClient

>

> strSQL = "SELECT o.keyid, o.orderid,

> o.orderrefno, o.custrefno, o.custkeyid, "_

> & "c.custid, c.custname, o.contactperson,

> o.ordermethod, sys1.codedesc AS ordermethod_desc, "_

> & "o.ordertype, sys2.codedesc AS

> ordertype_desc, o.orderdate, o.status, "_

> & "sys3.codedesc AS status_desc "_

> & "FROM (((orders AS o INNER JOIN customer

> AS c ON o.custkeyid=c.keyid) "_

> & "INNER JOIN codes_system AS sys1 ON

> o.ordermethod=sys1.keyid) "_

> & "INNER JOIN codes_system AS sys2 ON

> o.ordertype=sys2.codeid) "_

> & "INNER JOIN codes_system AS sys3 ON

> o.status=sys3.codeid "_

> & "WHERE (((o.custkeyid)=c.keyid) And

> ((o.ordermethod)=sys1.keyid) "_

> & "And ((o.ordertype)=sys2.codeid) And

> ((o.status)=sys3.codeid))"

>

>

> rs.Open strSQL, conn,adOpenForwardOnly,

> adLockReadOnly, adCmdText

>

>

> If Len(Request("pagenum")) = 0  Then

> rs.AbsolutePage = 1

> Else

> If CInt(Request("pagenum"))

> <= rs.PageCount Then

>

> rs.AbsolutePage = Request("pagenum")

> Else

>

> rs.AbsolutePage = 1

> End If

> End If

>

> Dim abspage, pagecnt

> abspage = rs.AbsolutePage

> pagecnt = rs.PageCount

>

> If Not rs.EOF Then

> Response.Write "PageCount : " &

> rs.PageCount & "<br>" & vbcrlf

> 'Response.Write "Absolute Page : "

> & rs.AbsolutePage & "<br>" & vbcrlf

>

> Response.Write "Total

> number of records : " & rs.RecordCount & "<br><br>" & vbcrlf

>

> Dim fldF, intRec

>

>

> Response.Write "<table

> border=1 align=center cellpadding=1 cellspacing=0

> ><thead><tr>"

>

> For Each fldF in rs.Fields

>

> Response.Write "<td>" & fldF.Name & "</td>"

> Next

>

> Response.Write "</tr></thead><tbody>"

>

> For intRec=1 To rs.PageSize

> If Not rs.EOF Then

>

> Response.Write "<tr>"

> For Each

> fldF in rs.Fields

>

> Response.Write "<td>" & fldF.Value & "</td>"

> Next

>

> Response.Write "<tr>"

> rs.MoveNext

> End If

> Next

>

> Response.Write "</tbody></table><p>"

>

>

> ' Now showing first, next,

> back, last buttons.

> Response.Write "<div

> align=""center"">" & vbcrlf

> Response.Write "<a href="""

> & Request.ServerVariables("SCRIPT_NAME") & "?

> pagenum=1"">First Page</a>"

>

> Response.Write "&nbsp;|&nbsp;"

>

> If abspage = 1 Then

> Response.Write "<span

> style=""color:silver;"">Previous Page</span>"

> Else

> Response.Write "<a href="""

> & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" &

> abspage - 1 & """>Previous Page</a>"

> End If

>

>

> Response.Write "&nbsp;|&nbsp;"

>

> If abspage < pagecnt Then

> Response.Write "<a href="""

> & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" &

> abspage + 1 & """>Next Page</a>"

> Else

> Response.Write "<span

> style=""color:silver;"">Next Page</span>"

> End If

>

> Response.Write "&nbsp;|&nbsp;"

> Response.Write "<a href="""

> & Request.ServerVariables("SCRIPT_NAME") & "?pagenum=" &

> pagecnt & """>Last Page</a>"

> Response.Write "</div>" &

> vbcrlf

>

> Else

> Response.Write "No records found!"

> End If

>

> rs.Close

> Set rs = Nothing

> %>

> </body>

> </html>

>

>

>

> Kim Iwan Hansen <kimiwan@k...> wrote:

>

> > what does your sql string look like?

> >

> > what does your code to print the recordset to the screen

> look

> > like?

> >

> > -Kim

> >

> > -----Original Message-----

> > From: Sridarti Herryanto [mailto:sridarti@s...]

> > Sent: 9. december 2001 08:31

> > To: ASP Databases

> > Subject: [asp_databases] Re: record paging

> >

> >

> > Hi,

> >

> > I have change the adCmdText, after testing, i can only

> view the

> > table header

> > instead of togehter with the records...why issit so? i

> had not

> > change

> > anything else...whihc was previously functionable.

> >

> > sri

> >

> >

> >

> >

> > ----- Original Message -----

> > From: "Ken Schaefer" <ken@a...>

> > To: "ASP Databases" <asp_databases@p...>

> > Sent: Sunday, December 09, 2001 1:08 PM

> > Subject: [asp_databases] Re: record paging

> >

> >

> > > If you use an SQL statement you need to use adCmdText

> as the

> > CommandTypeEnum

> > > Option, not adCmdTableDirect.

> > >

> > > adCmdTableDirect means that the first parameter is a

> table name

> > > adCmdText means that the first parameter is a text

> string (ie SQL)

> > that

> > the

> > > database will process

> > >

> > > Cheers

> > > Ken

> > >

> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> > > From: <sridarti@s...>

> > > Subject: [asp_databases] record paging

> > >

> > >

> > > : I have tried doing record paging...with the example

> below..below

> > is part

> > > : of the codes..my qs is, when i tried to insert a

> StrSQL before

> > the line

> > > :

> > > : rs.Open sqrSQl, conn, adOpenForwardOnly,

> adLockReadOnly,

> > adCmdTableDirect

> > > :

> > > : it does not work...but if i take out the strSQL

> statement and

> > just

> > simple

> > > :

> > > : rs.Open "table name", conn, adOpenForwardOnly,

> adLockReadOnly,

> > > : adCmdTableDirect

> > > :

> > > :

> > > : it works...why is it so?? is there no other way where

> i can

> > record

> > paging

> > > : with a select statement? this being i do not want to

> display

> > everything

> > > : thats in teh DB....

> > >

> > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> > >

> > >





> > $subst('Email.Unsub').

> >

> >





> > $subst('Email.Unsub').

> >

> >





> > $subst('Email.Unsub').

> >

>




> $subst('Email.Unsub').

>

>




$subst('Email.Unsub').




  Return to Index