Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Problem with updating
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with updating

 Post Reply Post Reply
Author
BlackGoldFish View Drop Down
Newbie
Newbie


Joined: 15 March 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote BlackGoldFish Quote  Post ReplyReply Direct Link To This Post Topic: Problem with updating
    Posted: 15 March 2006 at 3:56pm
Hi, I was doing the guestbook asp tutorial available on this site and everything worked fine up until I tried to do the updating section. I have made a few cosmetic changes but nothing major. I can select the entry I wish to update and fill in the form stating what I want it changed to but when I try to submit it I get the following error:

ADODB.Recordset (0x800A0CB3)
Current Recordset does not support updating. This may be a limitation of the provider, or of the selected locktype.

The piece of code in question looks like this.
'Update the record in the recordset
rsUpdateEntry.Fields("Name") = Request.Form("name")
rsUpdateEntry.Fields("Surname") = Request.Form("surname")

I'm running this with an access database on a windows 2000 machine.
I'm not realy into programming but if anyone can suggest something that isn't too technical I'd really appreciate it.
Back to Top
site master View Drop Down
Newbie
Newbie


Joined: 08 January 2006
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote site master Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2006 at 12:05pm
if i understand you currectly

you have wrong locktype...

i think you wrote somthing like this:
rs.open .....,con,3,1

locktype number 1 does not support updating
put the locktype to 3 and i think it will work

Edited by site master - 16 March 2006 at 12:06pm
Back to Top
BlackGoldFish View Drop Down
Newbie
Newbie


Joined: 15 March 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote BlackGoldFish Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2006 at 2:17pm
I'm not really sure what you mean, but then again I know nothing about ASP, I only started using it on Monday. This is all of my code for that page. It should give you abetter idead of what I was doing then I could.

<% '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("IDNum"))

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tester.mdb")

'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 tblNames.* FROM tblNames WHERE IDNum=" & lngRecordNo

'Set the cursor type we are using so we can navigate through the recordset
rsUpdateEntry.CursorType = 2

'Open the recordset with the SQL query
rsUpdateEntry.Open strSQL, adoCon

'Update the record in the recordset
rsUpdateEntry.Fields("Name") = Request.Form("name")
rsUpdateEntry.Fields("Surname") = Request.Form("surname")

'Write the updated recordset to the database
rsUpdateEntry.Update

'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"
%>
Back to Top
site master View Drop Down
Newbie
Newbie


Joined: 08 January 2006
Status: Offline
Points: 33
Post Options Post Options   Thanks (0) Thanks(0)   Quote site master Quote  Post ReplyReply Direct Link To This Post Posted: 16 March 2006 at 2:21pm


<% '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("IDNum"))

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")

'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("tester.mdb")

'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 tblNames.* FROM tblNames WHERE IDNum=" & lngRecordNo

'Set the cursor type we are using so we can navigate through the recordset

rsUpdateEntry.CursorType = 3
rsUpdateEntry.locktype = 3

'Open the recordset with the SQL query
rsUpdateEntry.Open strSQL, adoCon

'Update the record in the recordset
rsUpdateEntry.Fields("Name") = Request.Form("name")
rsUpdateEntry.Fields("Surname") = Request.Form("surname")

'Write the updated recordset to the database
rsUpdateEntry.Update

'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"
%>

Back to Top
BlackGoldFish View Drop Down
Newbie
Newbie


Joined: 15 March 2006
Status: Offline
Points: 3
Post Options Post Options   Thanks (0) Thanks(0)   Quote BlackGoldFish Quote  Post ReplyReply Direct Link To This Post Posted: 20 March 2006 at 1:20pm
Excellent that worked, thanks a lot.
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.