What is the problem actually?

A

azza

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>
 
D

Daniel Crichton

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,969
Messages
2,570,161
Members
46,710
Latest member
bernietqt

Latest Threads

Top