Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Classic ASP

Reply
 
LinkBack Thread Tools
Old January 17th, 2006, 05:59 AM   #1
New Member
 

Join Date: Jan 2006
Age: 41
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 barnet is on a distinguished road
updating a database using a drop down

Hi
I am having problems updating my database using a dropdown menu can someone see where I have gone wrong:
Error:
ADODB.Recordset error '800a0bcd'
Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.
/update_style.asp, line 34
************************************************** *******
drop down form:
<%
'Dimension variables
Dim styConn 'Holds the Database Connection Object
Dim rsstyle 'Holds the recordset for the records in the database
Dim strstyke 'Holds the SQL query for the database
Dim lngRecordNo2 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo2 = Request.QueryString("RemID")
'Create an ADO connection object
Set styConn = Server.CreateObject("ADODB.Connection")
styconn="PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=ny database connection is here that's not the problem;"
'Create an ADO recordset object
Set rsstyle = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strstyle = "SELECT memorial.pagestyle FROM memorial where remid=" & lngRecordNo2
'Open the recordset with the SQL query
rsstyle.Open strstyle, styConn
%>
<form name="form" method="post" action="update_style.asp?remid=<%=lngRecordNo2%>">
<tr>
<td width="50%">
<select size="5" name="pagestyle" style="width: 95%;" style="border:1px outset #5286A5; " style="border:1px outset #5286A5; " multiple style="border: 1px outset #5286A5">
<option value="Bible">Bible</option>
<option value="boat">boat</option>
<option value="candles">candles</option>
<option value="child1">child1</option>
<option value="child2">child2</option>
<option value="cross">cross</option>
<option value="diary">diary</option>
<option value="footprints">footprints</option>
<option value="heaven1">heaven1</option>
<option value="landscape">landscape</option>
<option value="music">music</option>
<option value="ocean">ocean</option>
<option value="ponga">ponga</option>
<option value="rose">Rose</option>
<option value="rose2">Rose2</option>
<option value="sky">Sky</option>
<option value="toitoi">Toitoi</option>
<option value="valley">Valley</option>
</select></td>
<td width="50%">
<font face="Arial" size="2" color="#5286A5">
Click here to view what each style
template looks like.</font></td>
</tr>
<tr>
<td width="100%" colspan="2" align="center">
<input type="submit" value="Submit New Style" name="style" style="color: #FFFFFF; font-weight: bold; border: 1px solid #5286A5; background-color: #5286A5"></td>
</tr>
</form>
<%
'Reset server objects
rsstyle.Close
Set rsstyle = Nothing
Set styCon = Nothing
%>
************************************************** *
The scripted page after submission:
<!-- #INCLUDE FILE="connection.asp" -->
<% 'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsUpdateEntry 'Holds the recordset for the record to be updated
Dim strSQL 'Holds the SQL query to query the database
Dim lngRecordNo 'Holds the record number to be updated
'Read in the record number to be updated
lngRecordNo = CLng(Request.Form("Remid"))
'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")
'Set an active connection to the Connection object using DSN connection
adoCon.Open Connect_String
'Create an ADO recordset object
Set rsUpdateEntry = Server.CreateObject("ADODB.Recordset")
'Initialise the strSQL variable with an SQL statement to query the database
strSQL = "SELECT memorial.pagestyle FROM memorial WHERE remid=" & lngRecordNo
'Set the cursor type we are using so we can navigate through the recordset
rsUpdateEntry.CursorType = 2
'Set the lock type so that the record is locked by ADO when it is updated
rsUpdateEntry.LockType = 3
'Open the recordset with the SQL query
rsUpdateEntry.Open strSQL, adoCon
'Update the record in the recordset
rsUpdateEntry.Fields ("pagestyle") = Request.Form ("pagestyle")
'Write the updated recordset to the database
rsUpdateEntry.Update
DIM strCustomerID
strCustomerID = rsupdateentry("remID")
'Reset server objects
rsUpdateEntry.Close
Set rsUpdateEntry = Nothing
Set adoCon = Nothing
'Return to the update select page in case another record needs deleting
'Response.Redirect "update_select.asp"
Response.Redirect ("editmemorial.asp?REMID=") & strcustomerid
%>
barnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old January 17th, 2006, 12:53 PM   #2
Reputable Member
 

Join Date: Sep 2003
Location: USA
Posts: 112
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 jakyra is on a distinguished road
Re: updating a database using a drop down

Which script is generating the error the dropdown dreation or the one to update the database?

In general though it means your select statement isn't returning any records and then you're trying to read from it which it can't, because it's not there.

FYI, you shouldn't hold the recordset object open like that. It's a huge performance problem. http://www.learnasp.com/advice/whygetrows.asp
jakyra is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old January 17th, 2006, 01:03 PM   #3
New Member
 

Join Date: Jan 2006
Age: 41
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 barnet is on a distinguished road
Re: updating a database using a drop down

Hi Jakyra

Thanks for your help ... the error accures when the information is submitted ... the second lot of code ... I will take your advice and give it a go
barnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old January 17th, 2006, 04:55 PM   #4
New Member
 

Join Date: Jan 2006
Age: 41
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 barnet is on a distinguished road
Re: updating a database using a drop down

Problem solved

The remid was not being picked up in part of the script .... fixed and now working perfectly....
barnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old January 17th, 2006, 09:28 PM   #5
Highly Reputable Member
 

Join Date: May 2005
Location: U.K
Age: 22
Posts: 728
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 benbramz will become famous soon enough
Re: updating a database using a drop down

can you use [code] tags next time please..
benbramz is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks

Tags
updating , database , using , drop , down


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Drop down menus drop behind flash header theGAME71135 Flash and ActionScript 3 January 10th, 2008 05:42 AM
updating database with password franknu PHP 1 October 23rd, 2006 07:30 PM
updating database franknu PHP 4 October 8th, 2006 04:32 PM
Updating Database Using ASP and XML cmomah Classic ASP 0 October 12th, 2005 04:22 PM
Updating Database Through XML cmomah Other Languages 0 October 12th, 2005 04:21 PM


Search Engine Optimization by vBSEO 3.2.0 RC8