Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP General > What is the problem actually?

Reply
Thread Tools

What is the problem actually?

 
 
azza
Guest
Posts: n/a
 
      03-28-2007
Either BOF or EOF is True, or the current record has been deleted. Requested
operation requires a current record.
/PROJECT/edit.asp, line 39


<%@ LANGUAGE="JAVASCRIPT" %>
<%
var refer = String(Request.ServerVariables("QUERY_STRING"));
var Item2 = refer.substring(3);
var MM_connInviTT_STRING;
MM_connInviTT_STRING = "Provider=Microsoft.JET.OLEDB.4.0;Data
Source=C:/Inetpub/wwwroot/PROJECT/Record.mdb"
var Conn = Server.CreateObject("ADODB.Connection");
Conn.Open(MM_connInviTT_STRING);

var sql="SELECT * FROM aktiviti WHERE activity = '" + Item2 + "'";
var rs=Server.CreateObject("ADODB.Recordset");
rs.Open(sql, Conn);

if (Request("btnEdit") == "Update")
{

var prog= Request.Form("prog");
var bulan=Request.Form("bulan");

sql_update="UPDATE aktiviti SET bulan='"+bulan+"', activity='"+ prog +"'
WHERE refer='"+Item2+"'";
Conn.Execute(sql_update);
rs.Close();
rs = null;
Conn.Close();
Conn = null;
Response.Redirect("editNdelete.asp");
}
%>

<html><head><title>Update Detail</title></head>
<body background="pics/red.bmp">
<br><br><br>
<FORM METHOD="POST" ACTION="editNdelete.asp">
<table border=12 align="center" cellpadding=20 bgcolor="#ffcccc">
<tr><td colspan=2><p><b><font
color="#0000FF"><h2><center>MAKLUMAT</center></h2></font></b></p>
</td></tr>
<tr><td>
<table align="center" cellspacing=15 bgcolor="#ffcccc">
<tr><td>KOD</td><td>: <% Response.Write(rs.fields.item("refer"))%>
</td></tr>
<tr><td>BULAN</td><td>: <input type="text" name="bulan" size="2"
VALUE="<% =rs.fields.item("bulan")%>"> </td></tr>
<tr><td>PROGRAM</td><td>: <input type="text" name="prog" size="20"
VALUE="<% =rs.fields.item("activity")%>">
</td></tr><tr><td colspan=2 align="center"><INPUT TYPE="Submit"
NAME="btnEdit" VALUE="Update"></td></tr>
</td></tr></table>
</td></tr></table>
</FORM>
</body>
</html>
 
Reply With Quote
 
 
 
 
Daniel Crichton
Guest
Posts: n/a
 
      03-28-2007
azza wrote on Tue, 27 Mar 2007 18:54:37 -0700:

> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
> /PROJECT/edit.asp, line 39
>
> <%@ LANGUAGE="JAVASCRIPT" %>
> <%
> var refer = String(Request.ServerVariables("QUERY_STRING"));
> var Item2 = refer.substring(3);
> var MM_connInviTT_STRING;
> MM_connInviTT_STRING = "Provider=Microsoft.JET.OLEDB.4.0;Data
> Source=C:/Inetpub/wwwroot/PROJECT/Record.mdb"
> var Conn = Server.CreateObject("ADODB.Connection");
> Conn.Open(MM_connInviTT_STRING);
>
> var sql="SELECT * FROM aktiviti WHERE activity = '" + Item2 + "'";
> var rs=Server.CreateObject("ADODB.Recordset");
> rs.Open(sql, Conn);
>
> if (Request("btnEdit") == "Update")
> {
>
> var prog= Request.Form("prog");
> var bulan=Request.Form("bulan");
>
> sql_update="UPDATE aktiviti SET bulan='"+bulan+"', activity='"+ prog +"'
> WHERE refer='"+Item2+"'";
> Conn.Execute(sql_update);
> rs.Close();
> rs = null;
> Conn.Close();
> Conn = null;
> Response.Redirect("editNdelete.asp");
> }
> %>
>
> <html><head><title>Update Detail</title></head>
> <body background="pics/red.bmp">
> <br><br><br>
> <FORM METHOD="POST" ACTION="editNdelete.asp">
> <table border=12 align="center" cellpadding=20 bgcolor="#ffcccc">
> <tr><td colspan=2><p><b><font
> color="#0000FF"><h2><center>MAKLUMAT</center></h2></font></b></p>
> </td></tr>
> <tr><td>
> <table align="center" cellspacing=15 bgcolor="#ffcccc">
> <tr><td>KOD</td><td>: <% Response.Write(rs.fields.item("refer"))%>
> </td></tr>
> <tr><td>BULAN</td><td>: <input type="text" name="bulan" size="2"
> VALUE="<% =rs.fields.item("bulan")%>"> </td></tr>
> <tr><td>PROGRAM</td><td>: <input type="text" name="prog" size="20"
> VALUE="<% =rs.fields.item("activity")%>">
> </td></tr><tr><td colspan=2 align="center"><INPUT TYPE="Submit"
> NAME="btnEdit" VALUE="Update"></td></tr>
> </td></tr></table>
> </td></tr></table>
> </FORM>
> </body>
> </html>


If you read your code, it's obvious what the problem is - there is no
matching record to the Item2 variable. You should test for BOF and/or EOF
before trying to write data from the recordset out.

Also if you update you're closing rs, so that will cause problems too.

Dan


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem problem problem :( Need Help Mike ASP General 2 05-11-2004 08:36 AM



Advertisments