<html> <body> <% keyword=Request.Form("keyword") if keyword="" then keyword=Request.QueryString("keyword") end if %> <form name="form1" method="post" action="Sample11.asp"> ค้นหาจาก Description <input type="text" name="keyword" value="<%=keyword%>"> <input type="submit" name="Submit" value="ค้นหา"> </form> <% if keyword="" then Response.write("<br>กรุณากรอก Keyword เพื่อค้นหาจาก Field Description<hr>") else pageLen = 2 'กำหนดจำนวนแต่ละหน้าที่ต้องการแสดงกี่ Reccord pageNo = request.QueryString("pageNo") if pageNo="" then pageNo = 1 Set Conn=Server.Createobject("ADODB.Connection") Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("product.mdb"),"" , "" 'หรือจะใช้เป็น Conn.Open "product","","" sql ="Select * From product where description like '%"&keyword&"%'" Set RS =Server.CreateObject("ADODB.Recordset") RS.open Sql,Conn,1,3 Nrecord=RS.recordcount Rs.pageSize = pageLen totalPage = Rs.PageCount Rs.absolutePage = pageNo If Rs.EOF Then %> ไม่มีข้อมูลในตาราง ! <%Else%> <table border="1"> <tr bgcolor="Silver"> <td>id</td> <td>barcode</td> <td>Description</td> <td>Price</td> <td>Page</td> <td>writer</td> </tr> <% recNo=1 Do While Not RS.EOF and recNo <= pageLen %> <tr> <td><%= Rs("Id")%></td> <td><%= Rs("barcode")%></td> <td><%= Rs("description")%></td> <td><%= Rs("price")%></td> <td><%= Rs("page")%></td> <td><%= Rs("writer")%></td> </tr> <% recNo=recNo+1 RS.MoveNext Loop rs.close conn.close %> </table> <% end if %> <br> <br> จำนวน: <%=Nrecord%> รายการ<br> ขณะนี้อยู่หน้า <%=pageNo%> ในทั้งหมด <%=totalPage%> หน้า <% if cint(pageno) > 1 then %> <br> <a href="Sample11.asp?pageNo=1&keyword=<%=keyword%>">หน้าแรก</a> <a href="Sample11.asp?pageNo=<%=pageNo-1%>&keyword=<%=keyword%>">ย้อนกลับ</a> <% end if if cint(pageno) < totalPage then %> <a href="Sample11.asp?pageNo=<%=pageNo+1%>&keyword=<%=keyword%>">หน้าต่อไป</a> <a href="Sample11.asp?pageNo=<%=totalPage%>&keyword=<%=keyword%>">หน้าสุดท้าย</a> <% end if %> <br> กระโดดไปหน้า <%for idx = 1 to totalPage %> <a href="Sample11.asp?pageNo=<%=idx%>&keyword=<%=keyword%>"> <% if idx=cint(pageno) then%> <b><%=idx%></b> <%else %> <%=idx%> <%end if%> </a> <% next end if %>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง