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

HOME > ASP > ASP Forum > Error ที่เกิดก EOF or BOF มันเกิดจากอะไรหรือ เพราะตอนนี้ผมทำโค้ดแล้วไม่ผ่าน



 

Error ที่เกิดก EOF or BOF มันเกิดจากอะไรหรือ เพราะตอนนี้ผมทำโค้ดแล้วไม่ผ่าน

 



Topic : 071888

Guest




คือผมเขียนเว็บอยู่ แต่จะส่งข้ามเว็บเป็นภาษาไทยเพื่อให้มันไปติดต่อฐานข้อมูล แต่มันกลับเออเรอ ฟ้องว่า

ADODB.Recordset error '800a0bcd'

Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.

/test/newall.asp, line 32

มันเป็นที่ปัญหาอะไรหรอครับ

Error หลังจากที่กดคำว่าดูทั้งหมดอ่ะ

โค้ดหน้าแรก
News.asp (ASP)
<!--#include file="header.asp"-->
<!--#include file="menu.asp"-->
<!--#include file="newfunc.asp"-->

<td valign="top" class="f2">
<table border="0" ><tr><td  width="790" align="right">
<form action="newsearch.asp" method="post">
<input name="txtsearch" type="text" />
<input name="search" type="submit" value="ค้นหา" />
</form></td></tr></table>

<script type="text/javascript">
function show_review(id) {
	if(id == 1) {
		document.getElementById("review_1").style.display = '';
		document.getElementById("review_2").style.display = 'none';
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 2) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = '';
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 3) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = 'none';
		document.getElementById("review_3").style.display = '';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 4) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = 'none';		
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = '';
		document.getElementById("review_5").style.display = 'none';
	} else if(id == 5) {
		document.getElementById("review_1").style.display = 'none';
		document.getElementById("review_2").style.display = 'none';		
		document.getElementById("review_3").style.display = 'none';
		document.getElementById("review_4").style.display = 'none';
		document.getElementById("review_5").style.display = '';
	}
}
</script>
<br />
   <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_1" align="center">
      <tr>
        <td>
        <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    dim a,c
    a="ข่าวทั่วไป"
    call b(a) 
    %>
        </td>
      </tr>
    </table>

    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_2" style="display:none" align="center">
      <tr>
        <td>
       <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="ข่าวประกาศ"
    call b(a) 
    %>
        </td>
      </tr>
    </table>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_3" style="display:none" align="center">
      <tr>
        <td>
       <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="ข่าวกิจกรรม"
    call b(a) 
    %>
        </td>
      </tr>
    </table>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_4" style="display:none" align="center">
      <tr>
        <td>
        <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="ก่อนปริญญา"
    call b(a) 
    %>
        </td>
      </tr>
    </table>
    
    <table width="100%" border="0" cellspacing="0" cellpadding="0" id="review_5" style="display:none" align="center">
      <tr>
        <td>
        <a href="javascript:show_review(1);" title="ข่าวประชาสัมพันธ์">    <img src="images/buttomnew1.gif"  border="0" height="77" width="150"/> </a>
        <a href="javascript:show_review(2);" title="ข่าวประกาศ">    <img src="images/buttomnew5.gif" height="77" width="150"  border="0"/>    </a>
        <a href="javascript:show_review(3);" title="ข่าวกิจกรรม">    <img src="images/buttomnew2.gif" height="77" width="150" border="0"/>    </a>
        <a href="javascript:show_review(4);" title="ข่าวการศึกษาก่อนปริญญา">		<img src="images/buttomnew3.gif" height="77" width="150" border="0"/>        </a>
        <a href="javascript:show_review(5);" title="ข่าวการศึกษาหลังปริญญา">	<img src="images/buttomnew4.gif" height="77" width="150" border="0"/>	</a>
    <% 
    a="หลังปริญญา"
    call b(a) 
    %>
        </td>
      </tr>
    </table>

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

<!--#include file="footer.asp"-->




newfunc.asp(ASP)
<%
Function b(byref a)
dim con,strsql,rec
set con = Server.CreateObject("ADODB.Connection")
con.open "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root;pwd=admin;database=med;option=16384;"
strsql = "Select * from news,officer where newstype like '%" & a & "%' and news.of_username=officer.of_username   "
set rec=Server.CreateObject("ADODB.Recordset")
rec.open strsql,con
If rec.EOF then
	Response.write("Not Found")
End if


%>

<table border="0" width="790">
	<tr>
        <th bgcolor="#0066CC"><div align="center" style="color:#FFFFFF" >วันที่ประกาศ</div></th>
        <th  bgcolor="#0066CC"><div align="center" style="color:#FFFFFF">หัวข้อ</div></th>
        <th bgcolor="#0066CC"><div align="center" style="color:#FFFFFF">ผู้ประกาศ</div></th>
    </tr>
<%
	if a="ข่าวทั่วไป"  then
	dim z
	while not rec.EOF
%>
	<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newreport.asp?newid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
        
<%
z=rec.fields("newstype").value
rec.movenext
wend

%>
	<tr><td colspan="3">
	<div align="right"><a href="newall.asp?newty=<%=Server.URLEncode("ข่าวทั่วไป")%>"> ดูทั้งหมด</a>
    </div></td></tr>
<%
elseif a="ข่าวประกาศ"   then
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newcall.asp?newcid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend
%>
	<tr><td colspan="3">
	<div align="right"><a href="newall.asp?newty=<%=Server.URLEncode("ข่าวประกาศ")%>"> ดูทั้งหมด</a>
    </div></td></tr>
<%
elseif a="ข่าวกิจกรรม"   then
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newactivity.asp?newaid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend
%>
	<tr><td colspan="3">
	<div align="right"><a href="newall.asp?newty=<%=Server.URLEncode("ข่าวกิจกรรม")%>"> ดูทั้งหมด</a>
    </div></td></tr>
<%
elseif a="ก่อนปริญญา"   then
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
        <td width="400"><div align="center"><div align="left"><a href="newbefore.asp?newbid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend
%>
	<tr><td colspan="3">
	<div align="right"><a href="newall.asp?newty=<%=Server.URLEncode("ก่อนปริญญา")%>"> ดูทั้งหมด</a>
    </div></td></tr>
<%
else
while not rec.EOF
%>
<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
         <td width="400"><div align="center"><div align="left"><a href="newafter.asp?newfid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend
%>
	<tr><td colspan="3">
	<div align="right"><a href="newall.asp?newty=<%=Server.URLEncode("หลังปริญญา")%>"> ดูทั้งหมด</a>
    </div></td></tr>
<%
end if
%>
</table>

      

<%
'end If
rec.close()
con.close()
set rec=nothing
set con=nothing

End Function
%>


newall.asp(ASP)
<!--#include file="header.asp"-->
<!--#include file="menu.asp"-->


<td valign="top" class="f2">
<table border="0" ><tr><td  width="790" align="right">
<form action="newsearch.asp" method="post">
<input name="txtsearch" type="text" />
<input name="search" type="submit" value="ค้นหา" />
</form></td></tr></table>
<%

dim con,strsql,rec,lu
lu=newty
set con = Server.CreateObject("ADODB.Connection")
con.open "DRIVER={MySQL ODBC 5.1 Driver}; SERVER=localhost;UID=root;pwd=admin;database=med;option=16384;"
strsql = "Select * from News,officer where title like '%"& Request.QueryString("newty") &"%' and news.of_username=officer.of_username  "
set rec=Server.CreateObject("ADODB.Recordset")
rec.open strsql,con
If  rec.EOF  then

	'Response.write("Not Found")
End if

'Paging
dim pagelen,pageno,totalrecord,totalpage,intID
dim pagestart,pageend
pagelen=10
pageno=Request.QueryString("Page")
if pageno = "" then pageno = 1
totalrecord= UBound(rec.GetRows,2)+1
pagestart=((pagelen*pageno)-pagelen)
pageend=pagelen
if totalrecord<=pagelen then
	totalpage=1
elseif (totalrecord Mod pagelen =0) then
	totalpage=(totalrecord/pagelen)
else
	totalpage=(totalrecord/pagelen)+1
	totalpage=cint(totalpage)
end if

'colse object and open new record set
rec.close()
strsql= strsql&"ORDER BY newsid ASC LIMIT "&pagestart&","&pageend&""
rec.open strsql,con

%>



<table border="0" width="790">
	<tr>

        <th bgcolor="#0066CC"><div align="center" style="color:#FFFFFF" >วันที่ประกาศ</div></th>
        <th  bgcolor="#0066CC"><div align="center" style="color:#FFFFFF">หัวข้อ</div></th>
        <th bgcolor="#0066CC"><div align="center" style="color:#FFFFFF">ผู้ประกาศ</div></th>
    </tr>
<%
    Response.Write(strsql)
	while not rec.EOF
%>
	<tr>
    	<td width="200"><div align="center"><%=rec.fields("ddate").value%></div></td>
        <%
		if rec.fields("newstype")="ข่าวทั่วไป" or rec.fields("newstype")="ข่าวประกาศ"  then
		%>
        <td width="400"><div align="center"><div align="left"><a href="newreport.asp?newid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <%
		elseif rec.fields("newstype")="ข่าวกิจกรรม" then
		%>
          <td width="400"><div align="center"><div align="left"><a href="newactivity.asp?newaid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <%
		elseif rec.fields("newstype")="ข่าวการศึกษาก่อนปริญญา" then
		%>
          <td width="400"><div align="center"><div align="left"><a href="newbefore.asp?newbid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
        <%
		else
		%>
          <td width="400"><div align="center"><div align="left"><a href="newafter.asp?newfid=<%=rec.fields("newsid").value%>" target="_blank" onclick="openWindow()"><%=rec.Fields("title").Value%></a></div></div></td>
          <%
		  end if
		  %>
        <td width="190"><div align="center"><%=rec.fields("of_name").value%></div></td>
    </tr>
<%
rec.movenext
wend
%>
</table>

        หน้าที่ <%=pageno%>  
        <% if cint(pageno) > 1 then %>
        <a href="<%Request.ServerVariables("SCRIPT_NAME")%>?page=1>"><<หน้าแรก</a>
        <a href="<%Request.ServerVariables("SCRIPT_NAME")%>?page=<%=pageno-1%>">< ก่อนหน้า</a>
        <% End if %>
        <% if cint(pageno)<totalpage then %>
        <a href="<%Request.ServerVariables("SCRIPT_NAME")%>?page=<%=pageno+1%>">ถัดไป ></a>
        <a href="<%Request.Servervariables("SCRIPT_NAME")%>?page=<%=totalpage%>">หน้าสุดท้าย >></a>
        <% End if %>
        <br />
        <% 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
rec.close()
con.close()
set rec=nothing
set con=nothing

%>
</td>
</tr>
</table>

<!--#include file="footer.asp"-->






Tag : ASP, MySQL







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-01-13 16:01:18 By : Clamore View : 13556 Reply : 1
 

 

No. 1



โพสกระทู้ ( 74,058 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

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

Quote:
z=rec.fields("newstype").value


เนื่องจาก rec มันไม่มี row น่ะครับ

ปกติจะใช้

Code (PHP)
if rec.eof then
	response.write("not found record")
else
	z=rec.fields("newstype").value
end if







แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-01-13 16:07:50 By : webmaster
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : Error ที่เกิดก EOF or BOF มันเกิดจากอะไรหรือ เพราะตอนนี้ผมทำโค้ดแล้วไม่ผ่าน
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 01
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 อัตราราคา คลิกที่นี่