 |
|
Either BOF or EOF Either BOF or EOF is True, or the current record has been deleted. Requested operat |
|
 |
|
|
 |
 |
|
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record
ใครรู้วิธีแก้ช่วยหน่อย
codeที่เขียนคือ
<%
dim keyword
dim kind
keyword=Request.QueryString("keyword")
kind=Request.QueryString("kind")
if keyword="" then
sql ="SELECT PartList.Function, PartList.MachineType, PartList.PID, Group.GroupName, SubGroup.SubGroupName, PartList.ArticleNo, PartList.PartDescription FROM SubGroup right JOIN ([Group] INNER JOIN PartList ON Group.GroupID=PartList.GroupID) ON SubGroup.SubGroupID=PartList.SubGroupID order by PartList.PID asc"
elseif kind="0" then
sql ="SELECT PartList.Function, PartList.MachineType, PartList.PID, Group.GroupName, SubGroup.SubGroupName, PartList.ArticleNo, PartList.PartDescription FROM SubGroup right JOIN ([Group] INNER JOIN PartList ON Group.GroupID=PartList.GroupID) ON SubGroup.SubGroupID=PartList.SubGroupID where PartList.ArticleNo like '"&keyword&"%'order by PartList.PID asc"
elseif kind="1" then
sql ="SELECT PartList.Function, PartList.MachineType, PartList.PID, Group.GroupName, SubGroup.SubGroupName, PartList.ArticleNo, PartList.PartDescription FROM SubGroup right JOIN ([Group] INNER JOIN PartList ON Group.GroupID=PartList.GroupID) ON SubGroup.SubGroupID=PartList.SubGroupID where Group.GroupName like '"&keyword&"%'order by PartList.PID asc"
elseif kind="2" then
sql ="SELECT PartList.Function, PartList.MachineType, PartList.PID, Group.GroupName, SubGroup.SubGroupName, PartList.ArticleNo, PartList.PartDescription FROM SubGroup right JOIN ([Group] INNER JOIN PartList ON Group.GroupID=PartList.GroupID) ON SubGroup.SubGroupID=PartList.SubGroupID where SubGroup.SubGroupName like '"&keyword&"%'order by PartList.PID asc"
elseif kind="3" then
sql ="SELECT PartList.Function, PartList.MachineType, PartList.PID, Group.GroupName, SubGroup.SubGroupName, PartList.ArticleNo, PartList.PartDescription FROM SubGroup right JOIN ([Group] INNER JOIN PartList ON Group.GroupID=PartList.GroupID) ON SubGroup.SubGroupID=PartList.SubGroupID where PartList.PartDescription like '"&keyword&"%'order by PartList.PID asc"
elseif kind="4" then
sql ="SELECT PartList.Function, PartList.MachineType, PartList.PID, Group.GroupName, SubGroup.SubGroupName, PartList.ArticleNo, PartList.PartDescription FROM SubGroup right JOIN ([Group] INNER JOIN PartList ON Group.GroupID=PartList.GroupID) ON SubGroup.SubGroupID=PartList.SubGroupID where PartList.Function like '"&keyword&"%'order by PartList.PID asc"
elseif kind="5" then
sql ="SELECT PartList.Function, PartList.MachineType, PartList.PID, Group.GroupName, SubGroup.SubGroupName, PartList.ArticleNo, PartList.PartDescription FROM SubGroup right JOIN ([Group] INNER JOIN PartList ON Group.GroupID=PartList.GroupID) ON SubGroup.SubGroupID=PartList.SubGroupID where PartList.MachineType like '"&keyword&"%'order by PartList.PID asc"
end if
pageLen = 20
pageNo = request.QueryString("pageNo")
if pageNo="" then pageNo = 1
strDbPathAndName = "saia.mdb"
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath(strDbPathAndName),"" , ""
Set Rs = Server.CreateObject("ADODB.Recordset")
RS.open Sql,Conn,3,3
Nrecord=RS.recordcount
Rs.pageSize = pageLen
totalPage = Rs.PageCount
Rs.absolutePage = pageNo
%>
<table width="933" height="75">
<!--DWLayoutTable-->
<tr><td width="240" height="25"> </td>
<td width="46"> </td>
<td width="142"> </td>
<td width="20"> </td>
<td width="111"> </td>
<td width="54"> </td>
<td width="279"> </td>
</tr><form name="se" method="get" action="showpart.asp">
<tr class="style4">
<td height="27"> </td>
<td valign="top">search</td>
<td valign="top" ><input type="text" name="keyword" class="style3" value="<%=keyword%>"></td>
<td valign="top">by</td>
<td valign="top"><select name="kind" class="style3" onChange="changetype()">
<option value="0">Part No SAIA</option>
<option value="1">Group Name</option>
<option value="2">SubGroup Name</option>
<option value="3">Part Description</option>
<option value="4">Function</option>
<option value="5">Machine Type</option>
</select></td>
<td valign="top"><input type="submit" name="Submit" value="Submit"></td>
<td> </td>
</tr>
</form>
<tr>
<td height="35"> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<% If RS.bof or RS.eof Then%>
can not
<%Else%>
<center>
<table border="0" bgcolor="#FDFBF2">
<tr bgcolor="#E0F1FC">
<td class="style4" height="25">ID</td>
<td class="style4">PART NO SAIA</td>
<td class="style4">GROUP NAME</td>
<td class="style4">SUBGROUP NAME</td>
<td class="style4">PART DESCRIPTION</td>
<td class="style4">FUNCTION</td>
<td class="style4">MACHINE TYPE</td>
</tr>
<%
recNo=1
While Not RS.EOF and recNo <= pageLen
%>
<tr>
<td class="style3"><a href="partdetail.asp?PID=<%= Rs("PID")%>&keyword=<%=keyword%>&kind=<%=kind%>"><%= Rs("PID")%></a></td>
<td class="style3"><%= Rs("ArticleNo")%></td>
<td class="style3"><%= Rs("GroupName")%></td>
<td class="style3"><%= Rs("subGroupName")%></td>
<td class="style3"><%= Rs("PartDescription")%></td>
<td class="style3"><%= Rs("Function")%></td>
<td class="style3"><%= Rs("MachineType")%></td>
</tr>
<%
recNo=recNo+1
RS.MoveNext
Wend
rs.close
conn.close
%>
</table> </center>
<%end if%>
<br>
<br><span class="style3">
total: <%=Nrecord%> item
<%if cint(pageno) > 1 then %>
<a href="showpart.asp?pageNo=1&keyword=<%=keyword%>&kind=<%=kind%>">first</a> <a href="showpart.asp?pageNo=<%=pageNo-1%>&keyword=<%=keyword%>&kind=<%=kind%>">back</a>
<% end if %>
<%for idx = 1 to totalPage%>
<a href="showpart.asp?pageNo=<%=idx%>&keyword=<%=keyword%>&kind=<%=kind%>">
<% if idx=cint(pageno) then%>
<b><%=idx%></b>
<%else %>
<%=idx%>
<%end if%>
</a>
<%next%>
<%if cint(pageno) < totalPage then %>
<a href="showpart.asp?pageNo=<%=pageNo+1%>&keyword=<%=keyword%>&kind=<%=kind%>">next</a> <a href="showpart.asp?pageNo=<%=totalPage%>&keyword=<%=keyword%>&kind=<%=kind%>">last</a>
<% end if%>
Tag : - - - -
|
|
 |
 |
 |
 |
Date :
5 ก.ค. 2549 17:37:08 |
By :
เจน |
View :
3488 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
สาเหตุที่เกิด Error
1.เปิด Record ที่ไม่มีในตารางจากฐานข้อมูล
2.กระทำการใดๆ ที่ไม่มี ใน Recordset ที่ select ออกมา
2.สั่งดำเนินการหลังจากทำงานไปจน Record สุดท้าย (ดำเนินการ หลัง EOF)
การหาคำตอบ
1.หาบรรทัดที่เกิด Error
2. เช็คข้อมูลตามสาเหตุที่ Error
ไม่งั้นไม่ง่ายครับ..โดยเฉพาะคนที่จะช่วยเหลือ
|
 |
 |
 |
 |
Date :
6 ก.ค. 2549 02:58:04 |
By :
ASP อ่อนหัด |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เกิด error ที่ line84
สามารถค้นหาข้อมูลได้ แต่คำที่ไม่มีใน database มันก็จะเกิดerror แบบข้างต้น
คือเพิ่งหัดเขียน asp ค่ะ
|
 |
 |
 |
 |
Date :
6 ก.ค. 2549 10:07:05 |
By :
เจน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เขียนดัก SCRIPT ครับ เช่น
IF RS.EOF Then
Response.write("Not found record.")
Else
'*************** เงื่อนไขอื่นๆ *****************'
End IF
|
 |
 |
 |
 |
Date :
6 ก.ค. 2549 10:33:12 |
By :
เอก |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
เคยเขียนแบบที่ คุณ เอก บอกแล้วค่ะแต่ไม่ได้
|
 |
 |
 |
 |
Date :
6 ก.ค. 2549 10:42:39 |
By :
เจน |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คืองี้ครับ..
คือตามหลักการแล้วเนี่ยะ การดัก ข้อมูลว่ามีข้อมูลออกมาหรือไม่ก็จะใช้วิธีอย่างที่คุณเอกบอกแหละครับ
ส่วนที่บอกว่าไม่ได้เนี่ยะ ไม่ได้จะ Error หรือว่ายังไงครับ

|
 |
 |
 |
 |
Date :
9 ก.ค. 2549 02:45:36 |
By :
ASP อ่อนหัด |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|