What is the problem actually?

What is the problem actually?

am 28.03.2007 03:54:37 von 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");
}
%>

Update Detail








color="#0000FF">

MAKLUMAT







KOD: <% Response.Write(rs.fields.item("refer"))%>
BULAN: VALUE="<% =rs.fields.item("bulan")%>">
PROGRAM: VALUE="<% =rs.fields.item("activity")%>">
NAME="btnEdit" VALUE="Update">




Re: What is the problem actually?

am 28.03.2007 14:32:07 von 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");
> }
> %>
>
> Update Detail
>
>



>


>
>
>

> color="#0000FF">

MAKLUMAT


>

>
>
>
>
>
KOD: <% Response.Write(rs.fields.item("refer"))%>
>
BULAN: > VALUE="<% =rs.fields.item("bulan")%>">
PROGRAM: > VALUE="<% =rs.fields.item("activity")%>">
>
> NAME="btnEdit" VALUE="Update">

>

>

>
>

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