Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Updating individual records
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Updating individual records

 Post Reply Post Reply
Author
simflex View Drop Down
Groupie
Groupie
Avatar

Joined: 10 November 2002
Location: United States
Status: Offline
Points: 63
Post Options Post Options   Thanks (0) Thanks(0)   Quote simflex Quote  Post ReplyReply Direct Link To This Post Topic: Updating individual records
    Posted: 29 November 2003 at 12:29pm

I have been struggling with this code now for 2 days.
Our client requires that we have 2 screens.
The first screen allows them to enter an id to be updated.
Once they click the submit button, they are taken to the second screen where records associated with the id are displayed.
One of those  records includes a dropdown menu; in this case, they are allowed to select a different record from the dropdown to be updated.
Once all records to be modified have been modified, the user then clicks save to save new modified records to the database.

No matter what I did, I keep getting this error message:

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

I know this means that no records are found but there are records on the database.
Below is my entire code.
Any help is greatly appreciated.

<%
Dim mode
mode=request.form("search")
set my_conn= Server.CreateObject("ADODB.Connection")
my_Conn.Open "DSN=guestbook"
sql="select * from guestbook"
set crs = my_Conn.execute(sql)
'Exeute this query and collect records in recordset crs
if mode<>"" then
code=request.form("code")
sql="select * from guestbook where ID=" & code
set crs = my_Conn.execute(sql)
'response.write sql
'response.end

'Execute this query and collect records in recordset rs
end if

if request.form("update")<>"" then
'collect the values from the form and update the database
end if
%>
<html>
<body>
<form name="f1" action="editJob.asp" method="post">
Enter Class Code:&nbsp;
<%if mode="" then%>
<input type=text name="code">
<input type=submit name="search" value="submit">
<%else%>
Class Code
<select name="code">
<%
while not crs.eof
if code=crs("id") then%>
<option selected value="<%=crs("id")%>"><%=crs("id")%></opt ion>
<%else%>
<option value="<%=crs("id")%>"><%=crs("id")%></opt ion>
<%end if
crs.movenext
wend%></select><br>
Title
<input type=text name="city" value="<%=crs("name")%>"><br>
Date
<input type=text name="state" value="<%=crs("city")%>"><br>
Name
<input type=text name="dob" value="<%=crs("dte")%>"><br>
<input type=submit name="update" value="save">
<%end if%>
</form>
</body>
</html>

 

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 29 November 2003 at 12:32pm
Back to Top
theSCIENTIST View Drop Down
Senior Member
Senior Member


Joined: 31 July 2003
Location: United Kingdom
Status: Offline
Points: 440
Post Options Post Options   Thanks (0) Thanks(0)   Quote theSCIENTIST Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2003 at 6:42am

I haven't dwelve much into your code, but let me ask you this:

On your 2nd screen the records shown are those associated with that ID?

You seem to be passing the ID with POST from 1st screen to 2nd screen, are you sure that from the 2nd screen you pass the ID in the way the update page expects it?

Are you sure you are passing the currect ID to the update query?

Can you view the database at all stages of the process to ensure your code is not messing up at some point?

Thx.



Edited by theSCIENTIST
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2003 at 9:19am
make sure that you surround the ID value in your select statement with "'" (apostrophe ' ' ' ' ' ' )
Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 30 November 2003 at 9:23am
Its the wrong way round Make sure you dont surround the ID value with apostrophes if its an autonumber
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.