Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > ASP > ASP SQL Server > ASP SQL Server Multiple Column and Paging/Pagination



Clound SSD Virtual Server

ASP SQL Server Multiple Column and Paging/Pagination

ASP SQL Server Multiple Column and Paging/Pagination ตัวอย่างนี้จะเป็นการเขียนโปรแกรม ASP กับ SQL Server โดยมีการดึงข้อมูลมาจาก Table แสดงผลออกเป็น Column (คอลัมบ์) และแบ่งออกเป็นหลาย ๆ หน้า Paging/Pagination

ตัวอย่าง

AspSQLServerColumnPaging.asp

<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com Tutorial</title>
</head>
<body>
<%
	Dim Conn,strSQL,objRec,intRows
	Set Conn = Server.Createobject("ADODB.Connection")
	Conn.Open "Driver={SQL Server};Server=localhost;Database=mydatabase;UID=sa;PWD=;"

	strSQL = "SELECT * FROM gallery "
	Set objRec = Server.CreateObject("ADODB.Recordset")
	objRec.Open strSQL, Conn, 1,3

	If objRec.EOF Then
		Response.write (" Not found record.")	
	Else

		Dim PageLen,PageNo,TotalRecord,TotalPage,No,intID
		PageLen = 4
		PageNo = Request.QueryString("Page")
		if PageNo = "" Then PageNo = 1
		TotalRecord = objRec.RecordCount
		objRec.PageSize = PageLen
		TotalPage = objRec.PageCount
		objRec.AbsolutePage = PageNo

		Response.Write("<table border='0' cellspacing='1' cellpadding='1'><tr>")
		

		No=1
		Do While Not objRec.EOF and No <= PageLen

			Response.Write("<td>")
%>
			<center>
				<img src="thaicreate/<%=objRec.Fields("Picture").Value%>"><br>
				<%=objRec.Fields("GalleryName").Value%>
				<br>
			</center>
<%
			Response.Write("</td>")
			If No Mod 2 = 0 Then
				Response.Write("</tr>")
			End If
			
		No = No + 1
		objRec.MoveNext
		Loop

		Response.Write("</tr></table>")
		
	End If
	
	objRec.Close()
	Conn.Close()
	Set objRec = Nothing
	Set Conn = Nothing
%>
	<br>
	Total : <%=TotalRecord%> Records.  Page <%=PageNo%> (All Page <%=TotalPage%>)
	<% IF Cint(PageNo) > 1 then %>
	<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=1"><< First</a> 
	<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=PageNo-1%>">< Back</a>
	<% End IF%>
	<% IF Cint(PageNo) < TotalPage Then %>
	<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=PageNo+1%>">Next ></a> 
	<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=TotalPage%>">Last >></a>
	<% End IF%>
	<br>
	Go to
	<% For intID = 1 To TotalPage%>
	<% if intID = Cint(PageNo) Then%>
	<b><%=intID%></b>
	<%Else%>
	<a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?Page=<%=intID%>"><%=intID%></a>
	<%End IF%>
	<%Next%>
</body>
</html>

Screenshot

ASP & SQL Server






   
Share


ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท


ลองใช้ค้นหาข้อมูล


   


Bookmark.   
       
  By : ThaiCreate.Com Team (บทความเป็นลิขสิทธิ์ของเว็บไทยครีเอทห้ามนำเผยแพร่ ณ เว็บไซต์อื่น ๆ)
  Score Rating :  
  Create/Update Date : 2010-08-07 09:48:17 / 2010-08-07 10:16:30
  Download : Download  ASP SQL Server Multiple Column and Paging/Pagination
 Sponsored Links / Related

 
ASP SQL Server Connect to Database
Rating :

 
ASP SQL Server List Table Properties
Rating :

 
ASP SQL Server List Record
Rating :

 
ASP SQL Server List Record (ODBC)
Rating :

 
ASP SQL Server Random Record
Rating :

 
ASP SQL Server List Record Paging/Pagination
Rating :

 
ASP SQL Server Search Record
Rating :

 
ASP SQL Server Multiple Column
Rating :

 
ASP SQL Server Search Record Paging/Pagination
Rating :

 
ASP SQL Server Add/Insert Record
Rating :

 
ASP SQL Server Check Already Exists Add/Insert Record
Rating :

 
ASP SQL Server Transaction (BeginTrans,CommitTrans,RollbackTrans)
Rating :

 
ASP SQL Server Edit/Update Record
Rating :

 
ASP SQL Server Delete Record
Rating :

 
ASP SQL Server Multiple Checkbox Delete Record
Rating :

 
ASP SQL Server Used Used Include Function
Rating :

 
ASP SQL Server Used Function Database Query
Rating :

 
ASP SQL Server Database Class
Rating :


ThaiCreate.Com Forum


Comunity Forum Free Web Script
Jobs Freelance Free Uploads
Free Web Hosting Free Tools

สอน PHP ผ่าน Youtube ฟรี
สอน Android การเขียนโปรแกรม Android
สอน Windows Phone การเขียนโปรแกรม Windows Phone 7 และ 8
สอน iOS การเขียนโปรแกรม iPhone, iPad
สอน Java การเขียนโปรแกรม ภาษา Java
สอน Java GUI การเขียนโปรแกรม ภาษา Java GUI
สอน JSP การเขียนโปรแกรม ภาษา Java
สอน jQuery การเขียนโปรแกรม ภาษา jQuery
สอน .Net การเขียนโปรแกรม ภาษา .Net
Free Tutorial
สอน Google Maps Api
สอน Windows Service
สอน Entity Framework
สอน Android
สอน Java เขียน Java
Java GUI Swing
สอน JSP (Web App)
iOS (iPhone,iPad)
Windows Phone
Windows Azure
Windows Store
Laravel Framework
Yii PHP Framework
สอน jQuery
สอน jQuery กับ Ajax
สอน PHP OOP (Vdo)
Ajax Tutorials
SQL Tutorials
สอน SQL (Part 2)
JavaScript Tutorial
Javascript Tips
VBScript Tutorial
VBScript Validation
Microsoft Access
MySQL Tutorials
-- Stored Procedure
MariaDB Database
SQL Server Tutorial
SQL Server 2005
SQL Server 2008
SQL Server 2012
-- Stored Procedure
Oracle Database
-- Stored Procedure
SVN (Subversion)
แนวทางการทำ SEO
ปรับแต่งเว็บให้โหลดเร็ว


Hit Link
   







Load balance : Server 04
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่