⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pro_typelist.asp

📁 网站源码
💻 ASP
字号:
<%@ codepage = 936 LCID = 2052 %>
<% if Session("exemple_status") <> "login" then response.redirect "login.asp" %>
<%
Response.expires = 0
Response.expiresabsolute = Now() - 1
Response.addHeader "pragma", "no-cache"
Response.addHeader "cache-control", "private"
Response.CacheControl = "no-cache"
%>
<!--#include file="db.asp"-->

<% 
displayRecs = 20
recRange = 10
%>

<%
' Get table name
tablename = "[pro_type]"
dbwhere = ""
a_search = ""
b_search = ""
%>



<%
' Get search criteria for basic search
pSearch = Request.QueryString("psearch")
If pSearch <> "" Then
	pSearch = replace(pSearch,"'","''")
	pSearch = replace(pSearch,"[","[[]")
	b_search = b_search & "[type_name] LIKE '%" & pSearch & "%' OR "
End If
If len(b_search) > 4 Then
	b_search = mid(b_search,1,len(b_search)-4)
	b_search = "(" & b_search & ")"
End If
%>



<%
'Build search criteria
If a_search <> "" Then
	dbwhere = dbwhere &  a_search 'advance search
ElseIf b_search <> "" Then
	dbwhere = dbwhere & b_search 'basic search
End If

'Save search criteria
If dbwhere <> "" Then
	Session("tablename") = tablename
	Session("dbwhere") = dbwhere
	'reset start record counter
	startRec = 1
	Session("<--##tablevar##-->_REC") = startRec
Else
	If tablename = Session("tablename") Then
		dbwhere = Session("dbwhere")
	Else
		'reset search criteria
		dbwhere = ""
		Session("dbwhere") = dbwhere
	End If
End If

'Get clear search cmd
If Request.QueryString("cmd").Count > 0 then
	cmd=Request.QueryString("cmd")
	If ucase(cmd) = "RESET" Then
		'reset search criteria
		dbwhere = ""
		Session("dbwhere") = dbwhere
	End If
End If

%>


<%
' Load Default Order
DefaultOrder = ""
DefaultOrderType = ""

' Check for an Order parameter
OrderBy = ""
If Request.QueryString("order").Count > 0 Then
	OrderBy = Request.QueryString("order")
	' Check if an ASC/DESC toggle is required
	If Session("<--##tablevar##-->_OB") = OrderBy Then
		If Session("<--##tablevar##-->_OT") = "ASC" Then
			Session("<--##tablevar##-->_OT") = "DESC"
		Else
			Session("<--##tablevar##-->_OT") = "ASC"
		End if
	Else
		Session("<--##tablevar##-->_OT") = "ASC"
	End If
	Session("<--##tablevar##-->_OB") = OrderBy
	Session("<--##tablevar##-->_REC") = 1
Else
	OrderBy = Session("<--##tablevar##-->_OB")
	if OrderBy = "" then
		OrderBy = DefaultOrder
		Session("<--##tablevar##-->_OB") = OrderBy
		Session("<--##tablevar##-->_OT") = DefaultOrderType
	End If
End If

' Open Connection to the database
set conn = Server.CreateObject("ADODB.Connection")
conn.Open xDb_Conn_Str

' Build Query
strsql = "select * from [pro_type]"

If dbwhere <> "" Then
	strsql = strsql & " WHERE " & dbwhere
End If

if OrderBy <> "" then 
		strsql = strsql & " ORDER BY [" & OrderBy & "] " & Session("<--##tablevar##-->_OT")
end if	

'response.write strsql

set rs = Server.CreateObject("ADODB.Recordset")
rs.Open strsql, conn, 1, 2 
totalRecs = rs.RecordCount

' Check for a START or PAGENO parameter
If Request.QueryString("start").Count > 0 Then
	startRec = Request.QueryString("start")
	Session("<--##tablevar##-->_REC") = startRec
ElseIf Request.QueryString("pageno").Count > 0 Then
	pageno = Request.QueryString("pageno")
	if isnumeric(pageno) then
		startRec = (pageno-1)*displayRecs+1
		if startRec <= 0 then
			startRec = 1
		elseif startRec >= ((totalRecs-1)\displayRecs)*displayRecs+1 then
			startRec = ((totalRecs-1)\displayRecs)*displayRecs+1
		end if
		Session("<--##tablevar##-->_REC") = startRec
	Else
		startRec = Session("<--##tablevar##-->_REC")
		if not isnumeric(startRec) or startRec = "" then
			'reset start record counter
			startRec = 1
			Session("<--##tablevar##-->_REC") = startRec
		End If
	End If
Else
	startRec = Session("<--##tablevar##-->_REC")
	if not isnumeric(startRec) or startRec = "" then
		'reset start record counter
		startRec = 1
		Session("<--##tablevar##-->_REC") = startRec
	End If
End If
%>

<!--#include file="header.asp"-->
<table width="100%" border="0" cellspacing="0" cellpadding="0" bgcolor="#336699"><tr><td>
<img src="images/bnrlist.gif" alt="" width="400" height="30" border="0"></td></tr></table>

<table width="100%" border="0" cellspacing="10" cellpadding="0"><tr><td>

<table border="0" cellspacing="1" cellpadding="4">
	<tr>
		<td>&nbsp;</td>
		<td height="0" align="left">
		<FORM ACTION="pro_typelist.asp">
		快速查找:&nbsp;&nbsp;&nbsp;
		<INPUT TYPE="Text" NAME="psearch" SIZE=10>
		<INPUT TYPE="Submit" NAME="Submit" VALUE="GO!"></FORM>
		</td>
		<td><a href="pro_typelist.asp?cmd=reset">[显示所有记录]</a></td>
	</tr>
</table>
<p>
<form>
 <table width="100%" height="40" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <td><a href="pro_typeadd.asp"><img src="images/addnew.jpg" alt="Add new" width="126" height="24"  border="0"></a></td>
  </tr>
</table>
<table width="500" border="0" cellspacing="1" cellpadding="5" bgcolor="cccccc">
<tr bgcolor="f5f5f5">
<td>
<a href="pro_typelist.asp?order=<%= Server.URLEncode("id") %>"><font color="">id&nbsp;</a>
</td>
<td>
<a href="pro_typelist.asp?order=<%= Server.URLEncode("type_name") %>"><font color="">类别名称&nbsp;</a>
</td>

<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>


<%
'Avoid starting record > total records
if clng(startRec) > clng(totalRecs) then
	startRec = totalRecs
end if
'Set the last record to display
stopRec = startRec + displayRecs - 1

'Move to first record directly for performance reason
recCount = startRec - 1
if not rs.eof then
	rs.movefirst
	rs.move startRec - 1
end if

recActual = 0
Do While (NOT rs.EOF) AND (recCount < stopRec)
	recCount = recCount + 1
	If Clng(recCount) >= Clng(startRec) Then 
		recActual = recActual + 1 %>

<%
	'set row color
	bgcolor="#FFFFFF"
%>


<%
	x_id = rs("id")
	x_type_name = rs("type_name")
%>


<tr bgcolor="<%= bgcolor %>">
<td>
<% response.write x_id %>&nbsp;
</td>
<td>
<% response.write x_type_name %>&nbsp;
</td>
<td><a href="pro_typeview.asp?key=<%=Server.URLEncode(rs("id")&"")%>"><img src="images/view.gif" alt="View" width="16" height="16" border="0"></a></td>
<td><a href="pro_typeedit.asp?key=<%=Server.URLEncode(rs("id")&"")%>"><img src="images/edit.gif" alt="Edit" width="16" height="16" border="0"></a></td>
<td><a href="pro_typedelete.asp?key=<%=Server.URLEncode(rs("id")&"")%>"><img src="images/delete.gif" alt="Delete" width="16" height="16" border="0"></a></td>
</tr>


<%
	end if

	rs.MoveNext
Loop 
%>

</table>

</td></tr></table>
</form>

<table border="0" cellspacing="0" cellpadding="10"><tr><td>
<%
if totalRecs > 0 then

	PrevStart = startRec - displayRecs
	If PrevStart < 1 Then PrevStart = 1
	NextStart = startRec + displayRecs
	If NextStart > totalRecs Then NextStart = startRec
	LastStart = ((totalRecs-1)\displayRecs)*displayRecs+1
	%>

<form>	
	<table border="0" cellspacing="0" cellpadding="0"><tr><td>Page&nbsp;</td>
<!--first page button-->
	<% If clng(startRec)=1 Then %>
	<td><img src="images/firstdisab.gif" alt="First" width="20" height="15" border="0"></td>
	<% Else %>
	<td><a href="pro_typelist.asp?start=1"><img src="images/first.gif" alt="First" width="20" height="15" border="0"></a></td>
	<% End If %>
<!--previous page button-->
	<% If clng(PrevStart) = clng(startRec) Then %>
	<td><img src="images/prevdisab.gif" alt="Previous" width="20" height="15" border="0"></td>
	<% Else %>
	<td><a href="pro_typelist.asp?start=<%=PrevStart%>"><img src="images/prev.gif" alt="Previous" width="20" height="15" border="0"></a></td>
	<% End If %>
<!--current page number-->
	<td><input type="text" name="pageno" value="<%=(startRec-1)\displayRecs+1%>" size="4" style="font-size: 9pt;"></td>
<!--next page button-->
	<% If clng(NextStart) = clng(startRec) Then %>
	<td><img src="images/nextdisab.gif" alt="Next" width="20" height="15" border="0"></td>
	<% Else %>
	<td><a href="pro_typelist.asp?start=<%=NextStart%>"><img src="images/next.gif" alt="Next" width="20" height="15" border="0"></a></td>
	<% End If %>
<!--last page button-->
	<% If clng(LastStart) = clng(startRec) Then %>
	<td><img src="images/lastdisab.gif" alt="Last" width="20" height="15" border="0"></td>
	<% Else %>
	<td><a href="pro_typelist.asp?start=<%=LastStart%>"><img src="images/last.gif" alt="Last" width="20" height="15" border="0"></a></td>
	<% End If %>
	<td><a href="pro_typeadd.asp"><img src="images/addnew.gif" alt="Add new" width="20" height="15" border="0"></a></td>
	<td>&nbsp;of <%=(totalRecs-1)\displayRecs+1%></td>
	</td></tr></table>	
</form>	
	<% If stopRec > recCount Then stopRec = recCount %>
	记录显示 从<%= startRec %>条到 <%= stopRec %>条  共<%= totalRecs %>条

<% Else %>

<p> 没有任何记录</p>
<p><a href="pro_typeadd.asp"><img src="images/addnew.gif" alt="Add new" width="20" height="15" border="0"></a></p>

<% End If %>
</td></tr></table>
<%
' Close recordset and connection
rs.Close
Set rs = Nothing
conn.Close
Set conn = Nothing %>
<!--#include file="footer.asp"-->

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -