|
|
|
แบ่งหน้า show ข้อมูล ตามที่เรา search asp พอคลิ๊กไปที่หน้า2ไม่มีการโยนค่าที่เรา search ไปให้รบกวนช่วยดู codeให้หน่อยค่ะ |
|
|
|
|
|
|
|
รบกวนช่วยดู code ให้หน่อยค่ะ ทำการแบ่งหน้าที่เรา search ไปแล้วพอเราคลิ๊กหน้าที่ 2 ทำไมถึงกลับไปที่หน้า เดิมไม่เข้าเงื่อนไขที่เรา search ไว้ค่ะ
Code (ASP)
<html>
<head>
<%
'if request("page") ="" then
'pageno =10
'else
'pageno=request("page")
'end if
%>
<%
PageSi=50 'กำหนดการแสดงผลต่อ 1 หน้า
if Request.QueryString("PageNo")="" then
PageNo=1 'ถ้าไม่มีการระบุหน้าเลขหน้า กำหนดให้เป็นหน้า 1
else
PageNo=Request.QueryString("PageNo") 'ตัวแปรระบุตำแหน่งหน้ารับค่าที่ส่งมา
end if
%>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<meta http-equiv="Content-Language" content="en-us">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>KCE P/N SAP</title>
<base target="_self">
<style type="text/css">
<!--
.style10 {font-size: 14px; font-family: "Times New Roman", Times, serif;}
.style2 { font-size: 16px;
color: #0033FF;
font-family: "Times New Roman", Times, serif;
}
.style5 {font-family: "Times New Roman", Times, serif; font-size: 14px; color: #0033FF; }
.style6 {color: #0066FF}
.style7 {color: #0033FF}
.style22 {font-family: "Times New Roman", Times, serif}
.style23 {
font-family: "Baskerville Old Face";
color: #FF0000;
font-weight: bold;
}
.style24 {font-family: "Baskerville Old Face"}
-->
</style>
</head>
<body bgcolor="#FFFBFD">
<form method="GET" action="kce_sap-6.asp">
<%
VInvPn = Request.QueryString("InvPn")
VSAP = Request.QueryString("SAP")
response.Write(VInvPn)
response.Write(VSAP)
%>
<div align="center">
<center>
<table border="1" width="90%" cellspacing="0" height="50" cellpadding="0" style="border: 1px solid #FF48A4; ; border-collapse:collapse">
<tr>
<td width="5%" height="5">
<p align="center"><b><font color="#0000CC" face="Times New Roman" size="5"><a href="http://kceiweb" target="_parent"><img border="0" src="file:///R|/images/kceilogo.gif" width="30" height="28" align="middle"></a></font></b>
</td>
<td width="88%" height="5">
<p align="center"><span class="style11"><span class="style22"><span class="style13 style19 style23">KCE P/N SAP <font face="Tahoma"><font face="MS Sans Serif" size="1"> </font></font></span></span></span></td>
<td width="7%" height="5">
<p align="center"><span class="style11"><span class="style22"><span class="style13 style19 style23"><font face="Tahoma"><font face="MS Sans Serif" size="1">Page : <%=pageno%></font></font></span></span></span>
</td>
</tr>
<tr>
<td width="5%" height="25">
<font size="3" face="MS Sans Serif">
</font>
</td>
<td width="88%" height="25" valign="top">
<p align="center"><font size="3"><span class="style24"><font color="#0066FF">KCEI P/N:</font></span></font><font size="3" face="MS Sans Serif"> <font color="#008000">
<input type="text" name="InvPn" size="24" value="<%=Request.QueryString("InvPn") %>">
</font></font><font size="3"><span class="style24"><font color="#0066FF">SAP P/N: </font><font color="#008000">
</font></span></font><font size="3" face="MS Sans Serif"><font color="#008000">
<input type="text" name="SAP" size="24" value="<%=Request.QueryString("SAP") %>">
</font>
<input type="submit" name="Submit" value="SEARCH">
</font>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="102%" id="AutoNumber1" align="left">
<tr>
<td width="150%" height="29"> </td>
</tr>
</table>
</td>
<td width="7%" height="25" valign="bottom"> <p align="center"><font size="3" face="MS Sans Serif"> </font> </td>
</tr>
</table>
</center>
</div>
<table border="0" width="100%" height="8" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" height="2"></td>
</tr>
</table>
<div align="center">
<center>
<table width="97%" height="57" border="1" cellpadding="0" cellspacing="0" bordercolor="#0000FF" bgcolor="#FFFFFF" style="border-collapse: collapse">
<tr bgcolor="#CCFF99">
<th width="180" height="25" nowrap bordercolor="#0000FF"><span class="style7"> <font style="font-size: 8pt"> </font><b><font style="font-size: 8pt"><span class="style10">KCE_PART</span></font></b></span></th>
<th width="180" height="25" nowrap><span class="style6"> <font style="font-size: 8pt"><font style="font-size: 8pt"> </font><b><font style="font-size: 8pt"><span class="style5">SAP_PART</span></font></b></font><b><font style="font-size: 8pt"></font></b></span></th>
<th width="240" height="25" nowrap><span class="style6"> <font style="font-size: 8pt"><font style="font-size: 8pt"> </font><b><font style="font-size: 8pt"><span class="style5">Customer_Part_Number</span></font></b></font></span></th>
<th width="271" height="25" nowrap><span class="style6"> <font style="font-size: 8pt"><font style="font-size: 8pt"> </font><b><font style="font-size: 8pt"><span class="style5">Customer_Part_Description</span></font></b> </font><b><font style="font-size: 8pt"></font></b></span></th>
<th width="129" height="25" nowrap><span class="style6"> <font style="font-size: 8pt"><font style="font-size: 8pt"> </font><b><font style="font-size: 8pt"><span class="style5">CP_REV</span></font></b></font><b><font style="font-size: 8pt"></font></b></span></th>
<th width="194" height="25" nowrap><span class="style6"> <font style="font-size: 8pt"><font style="font-size: 8pt"> </font><b><font style="font-size: 8pt"><span class="style5">Catalog_Number</span></font></b> </font><b><font style="font-size: 8pt"></font></b></span></th>
</tr>
<%
SET CON= SERVER.CREATEOBJECT("ADODB.CONNECTION")
CON.OPEN "Provider=SQLOLEDB.1;Data Source=192.1.1.17;Initial Catalog=PP;User ID=uread;Pwd=read"
SET RS = SERVER.CREATEOBJECT("ADODB.RECORDSET")
strsql = " select KCE_PN,SAP_PN,CUSTOMER_PART_NUMBER,CUSTOMER_PART_DESC,CP_REV,CATALOG_NUMBER "
strsql = strsql & " FROM "
strsql = strsql & " KCEI_SAP_PART Where KCE_PN like '" & VInvPn &"%' and SAP_PN like '"& VSAP&"%' "
strsql =strsql & " group by KCE_PN"
'straql =strsql & "
'response.Write(strsql)
'response.Write(VInvPn)
rs.cursorlocation = 3
rs.cursortype = 3
rs.activeconnection = con
RS.OPEN strsql ,CON ,1,3
Total = Rs.RecordCount
'PageCount=Rs.Recordcount
if rs.recordcount> 0 then
RS.MOVEFIRST
total=RS.Recordcount
pagesize=15
mtp = total\pagesize
totalpage = total\pagesize
if (total mod pagesize) <> "0" then
totalpage= totalpage+1
lpage = total mod pagesize
end if
RS.Move pagesize*(pageno-1)
a=1
endrecord = pagesize
if cint(pageno) > cint(mtp) then
endrecord= lpage
end if
end if
response.Write(total)
'response.Write( strsql)
%>
<%if not rs.eof then
Do while not Rs.Eof and n < PageSi
%>
<tr bordercolor="#0099FF">
<td height="17" nowrap><div align="left" class="style10"><font size="1" face="Times New Roman"><b><font style="font-size: 10pt"><%=rs("KCE_PN")%></font></b></font></div></td>
<td height="17" align="right" nowrap><div align="center"><div align="left" class="style10"><font size="1" face="Times New Roman"><b><font color="#000000" style="font-size: 10pt"><%=rs("SAP_PN")%></font></b></font></div></td>
<td height="17" align="right" nowrap><div align="left"></div>
<div align="left"><font size="1" face="Times New Roman"><font color="#000000" style="font-size: 10pt"><%=rs("CUSTOMER_PART_NUMBER")%></font></font></div></td>
<td height="17" align="right" nowrap><div align="left"><font size="1" face="Times New Roman"><font color="#000000" style="font-size: 10pt"><%=rs("CUSTOMER_PART_DESC")%></font></font></div></td>
<td height="17" align="right" nowrap><div align="center"><font size="1" face="Times New Roman"><font color="#000000" style="font-size: 10pt"><%=rs("CP_REV")%></font></font></div></td>
<td height="17" align="right" nowrap><div align="center"><font size="1" face="Times New Roman"><font color="#000000" style="font-size: 10pt"><%=rs("CATALOG_NUMBER")%></font></font></div></td>
</tr>
<%
rs.movenext
n=n+1
loop
RS.close
CON.close
End if %>
<tr bgcolor="#FFCCCC">
<td height="13" colspan="6" nowrap bordercolor="#0000FF"><div align="left"><b><font style="font-size: 16pt"><span class="style2"> TOTAL<%=total%></span></font></b></div></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0" style="font-family: MS Sans Serif; font-size: 8pt; font-weight: bold">
<tr>
<td width="74%" style="font-family: MS Sans Serif; font-size: 8pt; font-weight: bold" height="20" colspan="3"><b><font face="MS Sans Serif" size="1" color="#008000">Page :
<% For i=1 to totalpage%>
<% if i = Cint(Pageno) Then%>
<%=i%>
<%Else%>
<a href="kce_sap-6.asp?<%=InvPn %><%=VSAP%>PageNo=<% =i %>"><% =i %></A>
<%End IF%>
<%Next%>
</font></b><!--mstheme-->
</tr>
</table>
<p align="left"><b><font face="Tahoma"> </font></b> </p>
</center>
</div>
</form>
</body>
Tag : ASP
|
|
|
|
|
|
Date :
2011-09-16 14:24:13 |
By :
nnok |
View :
1719 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองดูตรง Link URL ครับ ว่ามันส่งค่าไปหรือเปล่า ?xxxx=xxxx&yyyy=yyyy
|
|
|
|
|
Date :
2011-09-16 17:19:31 |
By :
webmaster |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณมากค่ะ MR.WIN
ได้แล้วค่ะ
|
|
|
|
|
Date :
2011-09-19 09:19:42 |
By :
nnok |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 01
|