Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

problem with data update

Status
Not open for further replies.

raj8

IS-IT--Management
May 21, 2003
19
0
0
GB
hi i have problem with updating an existing record, i get the folloing error mess. My database has 6-7 records. Its working with other functionality

Error Type:
ADODB.Field (0x800A0BCD)
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
withdraw_money22.asp, line 10

here is my code
========================

<%
userName =Request(&quot;name&quot;)

set myCon =Server.CreateObject(&quot;ADODB.Connection&quot;)
myCon.open &quot;Provider=Microsoft.Jet.OLEDB.4.0;Data Source=&quot; & server.mappath(&quot;client_details.mdb&quot;)
Set RS = Server.CreateObject(&quot;ADODB.RecordSet&quot;)

RS.open &quot;SELECT cl_balance FROM my_table WHERE cl_name ='&quot; &userName& &quot;'&quot;,myCon,1,3

balance = RS(&quot;cl_balance&quot;)
====================================line 10
withdraw = request(&quot;amount&quot;)
balance = balance - withdraw
if balance > withdraw then
RS(&quot;cl_balance&quot;)=balance
Response.Write(&quot;transaction successful&quot;)
else
Response.Write(&quot;transaction unsuccessful&quot;)
end if

RS.Update

Response.Write RS(&quot;cl_balance &quot;)
Rs.Close
myCon.Close%>
 
Write the SQL string out to the screen and see if it returns rows via Query Analyzer...
 
Usually, after you open a recordset, you check to make sure that you have something in it...

RS.open &quot;SELECT cl_balance FROM my_table WHERE cl_name ='&quot; &userName& &quot;'&quot;,myCon,1,3

if rs.EOF then
response.write &quot;An error occurred - no record found&quot;
else
'process recordset
end if

Programming today is a race between software engineers striving to build better and bigger idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning. - Rich Cook
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top