เกี่ยวกับการแสดงหน้าแต่ละหน้า และคำสั่ง absolutepage
Code (ASP)
if rs.eof <> true then
เป็น
IF NOT rs.EOF Then
Date :
2009-10-29 10:01:30
By :
webmaster
Code (ASP)
<% Option Explicit %>
<html>
<head>
<title>ThaiCreate.Com ASP & Microsoft Access Tutorial</title>
</head>
<body>
<%
Dim Conn,strSQL,objRec
Set Conn = Server.Createobject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("mydatabase.mdb"),"" , ""
strSQL = "SELECT * FROM customer "
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 = 2
PageNo = Request.QueryString("Page")
if PageNo = "" Then PageNo = 1
TotalRecord = objRec.RecordCount
objRec.PageSize = PageLen
TotalPage = objRec.PageCount
objRec.AbsolutePage = PageNo
%>
<table width="600" border="1">
<tr>
<th width="91"> <div align="center">CustomerID </div></th>
<th width="98"> <div align="center">Name </div></th>
<th width="198"> <div align="center">Email </div></th>
<th width="97"> <div align="center">CountryCode </div></th>
<th width="59"> <div align="center">Budget </div></th>
<th width="71"> <div align="center">Used </div></th>
</tr>
<%
No=1
Do While Not objRec.EOF and No <= PageLen
%>
<tr>
<td><div align="center"><%=objRec.Fields("CustomerID").Value%></div></td>
<td><%=objRec.Fields("Name").Value%></td>
<td><%=objRec.Fields("Email").Value%></td>
<td><div align="center"><%=objRec.Fields("CountryCode").Value%></div></td>
<td align="right"><%=objRec.Fields("Budget").Value%></td>
<td align="right"><%=objRec.Fields("Used").Value%></td>
</tr>
<%
No = No + 1
objRec.MoveNext
Loop
%>
</table>
Total : <%=TotalRecord%> 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%>
<%
End IF
objRec.Close()
Conn.Close()
Set objRec = Nothing
Set Conn = Nothing
%>
</body>
</html>
Ref : ASP Microsoft Access List Record Paging/Pagination
Date :
2009-10-29 10:03:32
By :
webmaster
ขอรบกวนอีกรอบค่ะพี่
ตอนนี้เอาตัวอย่างที่ให้มามาลองใช้ดูแล้วโค้ดมันออกมาเป็นแบบนี้ค่ะ
Code (ASP)
Dim adoDoc,rs_SQL,rs ' Dim Conn,strSQL,objRec
Set rs = Server.CreateObject("ADODB.Recordset")
rs_SQL = xsql
rs.Open rs_SQL,Conn,1,1
If rs.EOF Then
Response.write (" Not found record.")
Else
Dim PageLen,PageNo,TotalRecord,TotalPage,No,intID
PageLen = 10 ' กำหนดว่าจะให้แสดงหน้าละกี่รายการ
PageNo = Request.QueryString("Page")
if PageNo = "" Then PageNo = 1
TotalRecord = rs.RecordCount
rs.PageSize = PageLen
TotalPage = rs.PageCount
rs.AbsolutePage = PageNo
%>
<table width="300%" border="1" cellpadding="1" cellspacing="0" bordercolor="#000000" >
<tbody>
<tr bgcolor="#999999" bordercolor="black" style="color:Black;background-color:Silver;" >
<td width="2%"><div align="center"><strong><font size="1">DOC ID<%=xSearch%></font></strong></div></td>
<td width="2%"><div align="center"><strong><font size="1">DOC TYPE<%=xDate1%></font></strong></div></td>
<td width="3%"><div align="center"><strong><font size="1">SUBTYPE </font></strong></div></td>
<td width="3%"><div align="center"><strong><font size="1">SUBSUBTYPE</font></strong></div></td>
<td width="5%"><div align="center"><strong><font size="1">PROJECT</font></strong></div></td>
<td width="3%"><div align="center"><strong><font size="1">CREATOR</font></strong></div></td>
<td width="4%"><div align="center"><strong><font size="1">VENDOR</font></strong></div></td>
<td width="4%"><div align="center"><strong><font size="1">DOC NUMBER</font></strong></div></td>
<td width="13%"><div align="center"><strong><font size="1">TITLE</font></strong></div></td>
<td width="4%"><div align="center"><strong><font size="1">DOC DATE </font></strong></div></td>
<td width="2%"><div align="center"><strong><font size="1">FILE TYPE</font></strong></div></td>
<td width="4%"><div align="center"><strong><font size="1">SOURCE_COMP</font></strong></div></td>
<td width="2%"><div align="center"><strong><font size="1">SOURCE LOGIN</font></strong></div></td>
<td width="5%"><div align="center"><strong><font size="1">SOURCE_PATH</font></strong></div></td>
<td width="6%"><div align="center"><strong><font size="1">SOURCE FILE</font></strong></div></td>
<td width="3%"><div align="center"><strong><font size="1">UPLOAD_ BY</font></strong></div></td>
<td width="4%"><div align="center"><strong><font size="1">UPLOAD_ ON</font></strong></div></td>
<td width="3%"><div align="center"><strong><font size="1">UPDATE_ BY</font></strong></div></td>
<td width="4%"><div align="center"><strong><font size="1">UPDATE_ ON</font></strong></div></td>
<td width="1%"><div align="center"><strong><font size="1">INUSE</font></strong></div></td>
</tr>
<% No=1
Do While Not rs.EOF and No <= PageLen %>
<tr>
<td ><div align="center"><a href="search2.asp?x2=<%=rs("Doc_type")%>&x3=<%=rs("Sub_type")%>&x4=<%=rs("Subsub_type")%>&x5=<%=rs("project")%>&x6=<%=rs("Creator")%>&x7=<%=rs("Vendor")%>&x8=<%=rs("doc_number")%>&x9=<%=rs("Title")%>&x10=<%=rs("Doc_date")%>&x11=<%=rs("doc_id")%>" target="_parent" >
<%=rs.fields("doc_id").value%></a></div></td>
<td><div align="center"><font size="2"><%=rs.fields("doc_type").value%></font></div></td>
<% if rs("sub_type") <>"" then %>
<td ><font size="2"><%= rs.fields("sub_type").value%></font></td>
<%else%>
<td><font size="2"> </font></td>
<%end if%>
<% if rs("subsub_type")<>"" then %>
<td><font size="2"><%= rs("subsub_type")%></font></td>
<%else %>
<td><font size="2"> </font></td>
<%end if%>
<% if rs("project")<>"" then%>
<td><font size="2"><%= rs.fields("project").value%></font></td>
<%else %>
<td><font size="2"> </font></td>
<%end if%>
<% if rs("creator")<>"" then%>
<td><font size="2"><%= rs.fields("creator").value%></font></td>
<%else %>
<td><font size="2"> </font></td>
<%end if%>
<% if rs("vendor")<>"" then%>
<td><font size="2"><%= rs.fields("vendor").value%></font></td>
<%else %>
<td><font size="2"> </font></td>
<%end if%>
<td><font size="2"><%= rs.fields("doc_number").value%></font></td>
<td><font size="2"><%= rs.fields("title").value%></font></td>
<td><font size="2"><%= rs.fields("doc_date").value%></font></td>
<td><div align="center"><font size="2"><%= rs.fields("file_type").value%></font></div></td>
<td><font size="2"><%= rs.fields("source_comp").value%></font></td>
<td><div align="center"><font size="2"><%= rs.fields("source_login").value%></font></div></td>
<td><font size="2"><%= rs.fields("source_path").value%></font></td>
<td><font size="2"><%= rs.fields("source_file").value%></font></td>
<td><div align="center"><font size="2"><%= rs.fields("upload_by").value%></font></div></td>
<td><div align="center"><font size="2"><%= rs.fields("upload_on").value%></font></div></td>
<td><div align="center"><font size="2"><%= rs.fields("update_by").value%></font></div></td>
<td><font size="2"><%= rs.fields("update_on").value%></font></td>
<td><div align="center"><font size="2"><%= rs.fields("inuse").value%></font></div></td>
</tr>
<%
No = No + 1
rs.MoveNext
Loop
%>
</table>
Total : <%=TotalRecord%> 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%>
<%
End IF
rs.Close()
adoDoc.Close()
Set rs = Nothing
Set adoDoc = Nothing
%>
</body>
</html>
ตอนนี้ที่ search ข้อมูลออกมาหน้าแรก
แต่พอกดจะดูหน้าที่ 2 หรือหน้าก่อน หลัง มันจะไป บอกว่า "Not found record. "
ทำไมถึงเป็นอย่างงี้อ่ะพี่
แล้วก็ไม่เข้าใจตรงคำสั่ง
rs.fileds.......value
แล้วก็คำสั่ง
<%Request.ServerVariables("SCRIPT_NAME")%>
ด้วยค่ะ
จากโค้ดที่แก้แล้วผิดตรงไหนอีกรึป่าว ต้องตั้งค่าหรือตัวแปรอะไรอีกไม๊อ่ะ ทำไมมันไม่ได้
จาตายยยอยู่แล้ว รบกวนด้วยนะค่ะ
Date :
2009-10-29 11:28:42
By :
poyz-say-hi
xsql คำสั่ง SQL Statement มันคืออะไรครับ
Date :
2009-10-29 11:49:21
By :
webmaster
Code (ASP)
<%@LANGUAGE="VBSCRIPT" CODEPAGE="874"%>
<%
Set adoDoc = Server.CreateObject("ADODB.connection")
Conn = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & server.MapPath("zDigitalLibrary.accdb")
adoDoc.open Conn
%>
<html>
<head>
<title>Result</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>
<body>
<%
xAct= Request.QueryString("x0")
xSearch= Request.QueryString("Search_Act")
xDocType = Request.QueryString("x1")
xSubType = Request.QueryString("x2")
xSubsubType = Request.QueryString("x3")
xProject = Request.QueryString("x4")
xCreator = Request.QueryString("x5")
xVendor = Request.QueryString("x6")
xDocnumber = Request.QueryString("x7")
xTitle = Request.QueryString("x8")
xArea = Request.QueryString("x9")
xUnit = Request.QueryString("x10")
xTagType = Request.QueryString("x11")
xTag = Request.QueryString("x12")
xManuf = Request.QueryString("x13")
xModel = Request.QueryString("x14")
xDate1 = Request.QueryString("x15")
xDate2 = Request.QueryString("x16")
' Nrecord = Request.QueryString("x17")
'response.write xArea &" : " & xUnit & " : " & xTagType & " : " & xTag & " : " & xManuf & " : " & xModel & " : " & xDoctype& " : "
if xAct <>"" then
xsql = "select a.* "
xsql = xsql & " from s_elib_docmast a "
If xArea <> "" Or xUnit <> "" Or xTagType <> "" Or xTag <> "" Or xManuf <> "" Or xModel <> "" Then
xsql = xsql & " , s_elib_doclink b "
End If
xsql = xsql & " where a.inuse = 'T' "
If xArea <> "" Or xUnit <> "" Or xTagType <> "" Or xTag <> "" Or xManuf <> "" Or xModel <> "" Then
xsql = xsql & " and b.inuse = 'T' "
xsql = xsql & " and a.doc_id = b.doc_id "
If xArea <> "" Then xsql = xsql & " and b.link_type = 'AREA' and b.link_key = '" & xArea & "' "
If xUnit <> "" Then xsql = xsql & " and b.link_type = 'UNIT' and b.link_key = '" & xUnit & "' "
If xTagType <> "" Then xsql = xsql & " and b.link_type = 'TAG_TYPE' and b.link_key = '" & xTagType & "' "
If xTag <> "" Then xsql = xsql & " and b.link_type = 'TAG' and b.link_key = '" & xTag & "' "
If xManuf <> "" Then xsql = xsql & " and b.link_type = 'MANUF' and b.link_key = '" & xManuf & "' "
If xModel <> "" Then xsql = xsql & " and b.link_type = 'MODEL' and b.link_key = '" & xModel & "' "
End If
If xDocType <> "" Then xsql = xsql & " and a.Doc_Type = '" & xDocType & "' "
If xSubType <> "" Then xsql = xsql & " and a.Sub_Type = '" & xSubType & "' "
If xSubSubType <> "" Then xsql = xsql & " and a.Subsub_Type = '" & xSubSubType & "' "
If xProject <> "" Then xsql = xsql & " and a.Project = '" & xProject & "' "
If xCreator <> "" Then xsql = xsql & " and a.Creator = '" & xCreator & "' "
If xVendor <> "" Then xsql = xsql & " and a.Vendor = '" & xVendor & "' "
If xDocnumber <> "" Then xsql = xsql & " and a.Doc_number = '" & xDocnumber & "' "
If xTitle <> "" Then xsql = xsql & " and a.Title = '" & xTitle & "' "
'date
''''' Oracle format =======================================================================
' If Text_Date(1).Text <> "" Then
' xsql = xsql & " and trunc(doc_date) >= trunc(to_date('" & Text_Date(1).Text & "','dd-mm-yyyy')) "
' End IfD
' xsql = xsql & " and trunc(doc_date) <= trunc(to_date('" & Text_Date(2).Text & "','dd-mm-yyyy')) "
' End If
'''''' Access2007 ========================================================================
If xDate1 <> "" Then xsql = xsql & " and Doc_Date >= Datevalue('" & xDate1 &"')"
If xDate2 <> "" Then xsql = xsql & " and Doc_Date <= Datevalue('" & xDate2 &"')"
' If xDate1 <> "" Then xsql = xsql & " and Doc_Date = '13-10-1988'"
' If xDate2 <> "" Then xsql = xsql & " and Doc_Date <= '" & xDate2 & "' "
' If xDate1 <> "" Then xsql = xsql & " and format(Doc_Date,'dd-mm-yyyy') >= '" & Format(xDate1, "dd-mm-yyyy") & "' "
' If xDate2 <> "" Then xsql = xsql & " and format(Doc_Date,'dd-mm-yyyy') <= '" & Format(xDate2, "dd-mm-yyyy") & "' "
' ===================================================================================
else
xsql = "select a.* "
xsql = xsql & " from s_elib_docmast a where doc_type ='-' "
end if
xsql = xsql & " Order by a.doc_id ASC "
' =====================================End Query ==============================================
ข้างบนเป็นคำสั่ง sql ที่อยู่ในหน้า result.asp ทั้งหมดค่ะ และหน้า result นี้จะแทรกที่คำสั่ง iframe ของหน้า search.asp
ข้างล่างเป็นโค้ดคำสั่งของหน้า search.asp ค่ะ
<%@LANGUAGE="VBSCRIPT" CODEPAGE="874"%>
<html>
<head>
<title>search</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
</head>
<body bgcolor="#E4E4E4">
<%
xAct =Request.Form("Act")'ตัวแปรเก็บค่าจากตัวเลือกในฟอร์ม
xDoctype = Request.Form("Doc_type")
xSubtype = Request.Form("Subtype")
xSubsubtype = Request.Form("Subsubtype")
xProject = Request.Form("Project")
xCreator = Request.Form("Creator")
xVendor = Request.Form("Vendor")
xDocnumber = Request.Form("Doc_number")
xTitle = Request.Form("Title")
xArea = Request.Form("Area")
xUnit = Request.Form("unit")
xTagType = Request.Form("Tagtype")
xTag = Request.Form("Tag")
xManuf = Request.Form("Manuf")
xModel = Request.Form("model")
xDate1 = Request.Form("Date1")
xDate2 = Request.Form("Date2")
Set adocon = Server.CreateObject("ADODB.Connection") 'ประกาศตัวแปร adocon เป็นตัวแปร object connectio จะเรียก ,method open ที่ใช้ติดต่อฐาน DigitalLibrary.accdb
strCon = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" & Server.MapPath("zDigitalLibrary.accdb") 'This one is for Access 2000/2002
%>
<form action="search.asp" method="post" name="search" target="_self" id="search">
<table width="100%" border="0">
<tr>
<td><strong><font size="5"color="#0033FF">Document Search</font></strong>
<hr align="left" color="#333333" size="4" width="50%" > </td>
</tr>
</table>
<table width="100%" border="0">
<tr>
<td><strong> <strong><font color="#5CB900" size="4">Detail</font></strong>
</strong><strong></strong><strong></strong><strong></strong><strong></strong></td>
<td colspan="3"> </td>
<td colspan="2"><strong><font color="#5CB900" size="4">Link</font></strong><strong></strong></td>
</tr>
<tr>
<td width="14%"><strong><font size="2">Document Type</font></strong></td>
<td width="20%"> <strong><font color="#0000FF" size="4">
<select style='width=130px' id=Doc_type name=Doc_type >
<option><%=xDoctype%></option>
<%
xsql = "select distinct(doc_type) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by doc_type "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("doc_type")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select>
</font></strong>><strong><font color="#0000FF" size="4"> </font></strong></td>
<td width="17%"><select style='width=120px' id=select3 name=subtype >
<option><%=xSubtype%></option>
<%
xsql = "select distinct(sub_type) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by sub_type "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("sub_type")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select> >></td>
<td width="15%"><select style='width=120px' id=select33 name=Subsubtype >
<option><%=xSubsub_type%></option>
<%
xsql = "select distinct(Subsub_type) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by Subsub_type "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("Subsub_type")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select> <font size="2"> </font><font size="2"> </font><font size="2"> </font><font size="2"> </font></td>
<td><font size="2"> <strong>Area</strong></font></td>
<td width="22%" colspan="2"><font size="2">
<select style='width=180px' id=select27 name=Area>
<option><%=xArea%></option>
<%
xsql = "select distinct(link_key) "
xsql = xsql & " from s_elib_doclink where inuse ='T' and (link_type = 'AREA' or link_type is null) "
xsql = xsql & " order by link_key "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
Do While Not rx.EOF
%>
<option><%=rx("link_key")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select>
</font></td>
</tr>
<tr>
<td><strong><font size="2">Project Number</font></strong></td>
<td colspan="3"><select style='width=316px' id=select34 name=Project >
<option><%=xProject%></option>
<%
xsql = "select distinct(project) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by project "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("project")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select> <font size="2"> </font><font size="2"> </font><font size="2"> </font></td>
<td width="12%"><font size="2"> <strong>Unit</strong></font></td>
<td colspan="2"><font size="2">
<select style='width=180px' id=select26 name=unit>
<option><%=xUnit%></option>
<%
xsql = "select distinct(link_key) "
xsql = xsql & " from s_elib_doclink where inuse ='T' and (link_type = 'UNIT' or link_type is null) "
xsql = xsql & " order by link_key "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,1
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("link_key")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select>
</font></td>
</tr>
<tr>
<td height="29"><strong><font size="2">Creator</font></strong></td>
<td><select style='width=130px' id=Creator name=Creator >
<option><%=xCreator%></option>
<%
xsql = "select distinct(creator) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by creator "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("creator")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select> ></td>
<td colspan="2"><select style='width=120px' id=select18 name=Vendor >
<option><%=xVendor%></option>
<%
xsql = "select distinct(vendor) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by vendor "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("vendor")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select> <font size="2"> </font><font size="2"> </font></td>
<td><font size="2"> <strong>Tag type</strong></font></td>
<td colspan="2"><font size="2">
<select style='width=180px' id=select36 name=Tagtype>
<option><%=xTagtype%></option>
<%
xsql = "select distinct(link_key) "
xsql = xsql & " from s_elib_doclink where inuse ='T' and (link_type = 'TAG_TYPE' or link_type is null)"
xsql = xsql & " order by link_key "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
Do While Not rx.EOF
%>
<option><%=rx("link_key")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select>
</font></td>
</tr>
<tr>
<td><strong><font size="2">Document Number</font></strong></td>
<td colspan="3"><select name=doc_number id=select35 style='width=316px' >
<option><%=xDoc_number%></option>
<%
xsql = "select distinct(doc_number) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by doc_number "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("doc_number")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select> <font size="2"> </font><font size="2"> </font></td>
<td><font size="2"> <strong>Tag</strong></font></td>
<td colspan="2"><font size="2">
<select style='width=180px' id=select29 name=Tag>
<option><%=xTag%></option>
<%
xsql = "select distinct(link_key) "
xsql = xsql & " from s_elib_doclink where inuse ='T' and (link_type = 'TAG' or link_type is null) "
xsql = xsql & " order by link_key "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("link_key")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select>
</font></td>
</tr>
<tr>
<td><strong><font size="2">Title</font></strong></td>
<td colspan="3"><select name=Title id=Title style='width=483px'>
<option><%=xTitle%></option>
<%
xsql = "select distinct(title) "
xsql = xsql & " from s_elib_docmast "
xsql = xsql & " order by title "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
rx.MoveFirst
Do While Not rx.EOF
%>
<option><%=rx("title")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select> <font size="2"> </font><font size="2"> </font></td>
<td><font size="2"> <strong>Manufacturer</strong></font></td>
<td colspan="2"><font size="2">
<select style='width=180px' id=select30 name=Manuf>
<option><%=xManuf%></option>
<%
xsql = "select distinct(link_key) "
xsql = xsql & " from s_elib_doclink where inuse ='T' and (link_type = 'MANUF' or link_type is null)"
xsql = xsql & " order by link_key "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
Do While Not rx.EOF
%>
<option><%=rx("link_key")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select>
</font></td>
</tr>
<tr>
<td><strong><font size="2">Date : from : to</font></strong></td>
<td colspan="3"> <input name="Date1" type="text" size="10" maxlength="10">
<input name="Date2" type="text" size="10" maxlength="10">
<font size="2"> </font><font size="2">
<input type="hidden" name="Act" value="A">
</font></td>
<td><font size="2"> <strong>Model</strong></font></td>
<td colspan="2"><font size="2">
<select style='width=180px' id=select31 name=model >
<option><%=xModel%></option>
<%
xsql = "select distinct(link_key) "
xsql = xsql & " from s_elib_doclink where inuse ='T' and (link_type = 'MODEL' or link_type is null) "
xsql = xsql & " order by link_key "
Set rx = Server.CreateObject("ADODB.Recordset")
rx_SQL = xsql
rx.Open rx_SQL, strCon,1,3
If rx.RecordCount <> 0 Then
Do While Not rx.EOF
%>
<option><%=rx("link_key")%></option>
<%
rx.Movenext
Loop
rx.close
End if
%>
</select>
</font></td>
</tr>
</table>
</hr>
<table width="100%" border="0">
<tr>
<td height="26"><div align="center"> </div>
<strong></strong></td>
<td width="66%"><font size="2">
<input name="Clear" type="reset" value="Clear"align="right" style= 'width=70px' >
<input name="search2" type="submit" value="Search"align="right" style= 'width=70px'>
<input name="exit" type="button" value="Exit"align="right" style= 'width=70px' >
<input name="Input" type="text" size="5" maxlength="5" value"<%=Nrecord%>" >
</font></td>
</tr>
<tr>
<td colspan="2"><p>
<iframe name="Result" src="result.asp?x0=<%=xAct %>&x1=<%=xDoctype %>&x2=<%=xSubtype %>&x3=<%=xSubsubtype %>&x4=<%=xProject %>&x5=<%=xCreator %>&x6=<%=xVendor %>&x7=<%=xDocnumber %>&x8=<%=xTitle %>&x9=<%=xArea%>&x10=<%=xUnit%>&x11=<%=xTagType%>&x12=<%=xTag%>&x13=<%=xManuf%>&x14=<%=xModel%>&x15=<%=xDate1%>&x16=<%=xDate2%>"scrolling="yes" width="950" height="280" ></iframe>
</p></td>
</tr>
</table>
</hr>
</form>
</body>
</html>
ยาวหน่อยแล้วก็ไม่รู้ว่าจะเกี่ยวกับหน้า search ไม๊แต่ก็เผื่อจะเกี่ยว โค้ดทั้งหมดก็มีเท่านี้แหละค่ะ
รบกวนด้วยนะค่ะ
ขอบคุณล่างหน้าค่ะ
ถ้าอันนี้ทำได้ก็คงจะหลุดพ้นจากกการงมโข่งซะที
Date :
2009-10-29 12:38:35
By :
poyz-say-hi
response.write xsql แล้วไป query ครับ
Date :
2009-10-29 12:49:00
By :
อิอิ
ผลออกมาเป็นแบบนี้
ก่อนที่ยังไม่ search
หลังจากที่คลิก search
หลังจากที่ click เพื่อไปที่หน้าต่อไปแล้วมันเป็นเป็นแบบนี้
Date :
2009-10-29 13:03:13
By :
poyz-say-hi
คุณจะต้องเอา SQL ทีได้ไปรันใน Query ดูครับ ส่ามันมี record ตามเงื่อนไข where หรือไม่
Date :
2009-10-29 13:07:15
By :
webmaster
ถามคุณ อิอิ หน่อยค่ะ
มันไม่เป็นที่ตัวคำสั่ง xsql ไม่ใช่หรอค่ะ เพราะว่า คิวรี่ได้ปกติ แต่มัน แบ่งหน้าไม่ได้
หรือว่ามันจะเกี่ยว
เอ๊ะยังไง
ช่วยตอบด้วยค่า
Date :
2009-10-29 13:07:18
By :
poyz-say-hi
กดที่ปุ่ม search แล้วผลมันออกมา มีหลาย record
แต่มันจะแสดงแค่ 10 record
เท่านั้น ต้องเอาไปรันใน query ยังไง
Date :
2009-10-29 13:12:36
By :
poyz-say-hi
พอกดแต่ละหน้าแล้วมันไปแสดงอ่ะ
จะไหวไม๊เนี้ยะ
ช่วยด้วยยยยย
Date :
2009-10-29 13:18:18
By :
poyz-say-hi
Date :
2009-10-29 13:20:46
By :
poyz-say-hi
Load balance : Server 03