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,030

HOME > ASP > ASP Forum > ช่วยทีนะ ขอร้องล่ะ พอดีเอาโค๊ดการแบ่งหน้าเว็บมาใส่ พอรันแล้วไม่เกิด Error แต่ตารางข้อมูลของเว็บบอร์ดไม่ยอมขึ้นมาจะทำอย่างไรดี



 

ช่วยทีนะ ขอร้องล่ะ พอดีเอาโค๊ดการแบ่งหน้าเว็บมาใส่ พอรันแล้วไม่เกิด Error แต่ตารางข้อมูลของเว็บบอร์ดไม่ยอมขึ้นมาจะทำอย่างไรดี

 



Topic : 004902

Guest




<%@ LANGUAGE="VBSCRIPT" %>

<!--#include file =conn.inc-->

<html>
<head>
<title>:: WEBBOARD ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-874"><style type="text/css">
<!--
body,td,th {
font-family: MS Sans Serif;
font-size: x-small;
}
body {
background-color: #668FB9;
}
a:hover {
color: #FF6600;
}
.style1 {
font-family: "MS Sans Serif";
font-size: x-small;
}
-->
</style></head>

<link rel=stylesheet href="main.css">
<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>
<div align=center> <img src="../IMAGE/Logo.jpg" width="780" height="191" border="0" usemap="#MapMap">
<map name="MapMap">
<area shape="rect" coords="400,173,458,191" href="../Data/data.htm">
<area shape="rect" coords="231,173,318,191" href="../Rules/rules.htm">
<area shape="rect" coords="318,172,399,188" href="bbs.asp">
<area shape="rect" coords="7,171,74,190" href="../Aboutus/aboutus.htm">
<area shape="rect" coords="457,173,513,196" href="../Contact/contact.htm">
<area shape="rect" coords="158,173,233,191" href="../Hotissue/hotissue.htm">
<area shape="rect" coords="73,172,156,190" href="../New/new.htm">
</map>
<table cellpadding=0 cellspacing=0 width=780 border=0>
<tr>
<td align=right><a href="bbs_post.asp"><span class="style1">สร้างข้อความใหม่</span></a><span class="style1">&gt;&gt;</span></td>
</tr>
</table>
<br>
<%
pageLen = 30
pageNo = request.QueryString("pageNo")
if pageNo="" then pageNo = 1
sql ="Select * From bbs"
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
%>

<table width=780 border=0 cellpadding=1 cellspacing=1 bgcolor="#000000">
<tr align=center height=25 bgcolor=#ffcc00>
<td width=85 class="style1">ลำดับที่</td>
<td width=380 class="style1">ชื่อเรื่อง</td>
<td width=110 class="style1">วันที่ส่ง</td>
<td width=32 class="style1">อ่าน</td>
<td width=32 class="style1">ตอบ</td>
<td width=110 class="style1">ตอบล่าสุด</td>
</tr>

<%
sql="select * from bbs where "
sql=sql&" topic_id=reply_id "
sql=sql&" order by date_post desc"
set rs=Conn.Execute(sql)
if not rs.eof then
do while not rs.eof
%>
<tr valign=top align=center bgcolor=f4f4f4>
<td width="85" class="style1"># <%=rs("topic_id")%></td>
<td width="380" align=left class="style1"><b><a href=bbs_open.asp?id=<%=rs("topic_id")%>><%=rs("title")%></a></b><br>
ผู้ส่ง <%=rs("poster")%>
</td>
<td width="110" class="style1"><%
response.write formatdatetime(rs("date_post"),1)&"<br>"
response.write formatdatetime(rs("date_post"),4)%></td>
<td width="32" class="style1"><%=rs("reads")%></td>
<td width="32" class="style1"><%=ctopic(rs("topic_id"))%></td>
<td width="110" class="style1"><%
if datediff("s",rs("date_reply"),rs("date_post"))=0 then
response.write "<br>"
else
response.write formatdatetime(rs("date_reply"),1)&"<br>"
response.write formatdatetime(rs("date_reply"),4)&"<br>"
if rs("post_reply")<>"" then
response.write "["&rs("post_reply")&"]"
end if
end if
%>
</td>
</tr>
<%
rs.movenext
loop
else
response.write "<tr height=60><td colspan=6 align=center bgcolor=#f4f4f4>ไม่พบข้อความในฐานข้อมูล.</td></tr>"
end if
set rs=nothing
%>
</table>

<table width="780" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<%
recNo=1
Do While Not RS.EOF and recNo <= pageLen
%>
<%
recNo=recNo+1
RS.MoveNext
Loop
rs.close
conn.close
%>
<%
end if
%>
<br>
<br>
จำนวน: <%=Nrecord%> รายการ<br>
ขณะนี้อยู่หน้า <%=pageNo%> ในทั้งหมด <%=totalPage%> หน้า
<%
if cint(pageno) > 1 then %>
<a href="bbs.asp?pageNo=1">หน้าแรก</a> &nbsp; <a href="bbs.asp?pageNo=<%=pageNo-1%>">ย้อนกลับ</a>
&nbsp;
<% end if
if cint(pageno) < totalPage then %>
<a href="bbs.asp?pageNo=<%=pageNo+1%>">หน้าต่อไป</a>&nbsp; <a href="bbs.asp?pageNo=<%=totalPage%>">หน้าสุดท้าย</a>
<%
end if
%>
<br>
ไปหน้า
<%for idx = 1 to totalPage
%>
<a href="bbs.asp?pageNo=<%=idx%>">
<% if idx=cint(pageno) then%>
<b><%=idx%></b>
<%else %>
<%=idx%>
<%end if%>
</a>&nbsp;
<%
next%>
</td>
</tr>
</table>
</div>
</body>
</html>
<%
function ctopic(x)
ctopic=0
sqlc="select count(reply_id) as topic from bbs where cstr(topic_id)='"&x&"' "
set rsc=Conn.Execute(sqlc)
if not rsc.eof then
ctopic=rsc("topic")-1
end if
set rsc=nothing
end function
%>


พอดีเอาโค๊ดการแบ่งหน้าเว็บมาใส่ พอรันแล้วไม่เกิด Error แต่ตารางข้อมูลของเว็บบอร์ดไม่ยอมขึ้นมาจะทำอย่างไรดี (โทษที โค๊ดยาวไปหน่อย )


Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 27 ก.ค. 2548 15:55:42 By : modx777 View : 13397 Reply : 1
 

 

No. 1



โพสกระทู้ ( 371 )
บทความ ( 0 )



สถานะออฟไลน์


ที่ดูๆๆ รู้สึกว่าใช้ Rs กะ rs ใน ASp จะถือว่าเป้นตัวเดียวกันนะครับตัวเล็กตัวใหญ่มีค่าเท่ากัน (Insensitive) แก้เป้นชื่ออื่นดีกว่า เช่น Rs2 แต่ดู Code รวมๆ ก็ OK
=========================
มีข้อคิดเห้นนิดหน่อย
=======================
<%
sql="select * from bbs where "
sql=sql&" topic_id=reply_id "
sql=sql&" order by date_post desc"
set rs=Conn.Execute(sql)
if not rs.eof then
do while not rs.eof
%>

ส่วนใหญ่เค้าจะใช้ยังนี้นะ

<%
sql="select * from bbs where "
sql=sql&" topic_id=reply_id "
sql=sql&" order by date_post desc"
set rs=Conn.Execute(sql)
do while not rs.eof and not rs.bof
%>






Date : 27 ก.ค. 2548 16:20:49 By : JezusMitsui
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยทีนะ ขอร้องล่ะ พอดีเอาโค๊ดการแบ่งหน้าเว็บมาใส่ พอรันแล้วไม่เกิด Error แต่ตารางข้อมูลของเว็บบอร์ดไม่ยอมขึ้นมาจะทำอย่างไรดี
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 00
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 อัตราราคา คลิกที่นี่