Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - ADO Update Method
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

ADO Update Method

 Post Reply Post Reply
Author
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 Topic: ADO Update Method
    Posted: 01 March 2003 at 10:15pm

I'm writing a small script. Basically all it does is assign some variables from a query string and adds the values to a database. When call rs.addnew (rs being my recordset object) I assign my values and everything runs fine until I attempt to update the database. When I call the update method it gives me an error saying that the database doesn't support updating. I know that the database needs to support updating but how do I get it too? The database is a standard MS Access one.

Thanks,

Back to Top
joshb View Drop Down
Groupie
Groupie


Joined: 26 June 2002
Location: United States
Status: Offline
Points: 134
Post Options Post Options   Thanks (0) Thanks(0)   Quote joshb Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2003 at 12:07am
what exactly is the error msg. does it say anything about cursortype? and are you sure you have it NOT read-only, and that you hae write-permissions to the db?
I'm a wannabe programmer that knows how to do nothing but create invalid procedure arguments.
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: 02 March 2003 at 10:15am
it was something along the lines of "this recordset does not support updating" or "limitations of the selected locktype" i've tried changing the locktype but it didn't work. I can't exactly reproduce the error because i can't connect to an asp supporting server at this time.
Back to Top
Ignorance View Drop Down
Newbie
Newbie


Joined: 23 February 2003
Status: Offline
Points: 28
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ignorance Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2003 at 3:37pm
Check your permissions on the database file itself as well as the directory you have it in. Normally the "IUSR_machinename" account that IIS uses needs to have write access to both. I think I read somewhere around here that you can get away with giving the account full control permissions over the directory the database is in and let it propogate down.
Back to Top
Bunce View Drop Down
Senior Member
Senior Member
Avatar

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post Posted: 02 March 2003 at 4:53pm

Show us the code that is causing the error, and copy the exact error message for us to see.

This is the first thing you should do after searching the web and FAQ section for your problem, which is one of the most common found.

Cheers,
Andrew

There have been many, many posts made throughout the world...
This was one of them.
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: 03 March 2003 at 3:14pm

Alright, here's the code. As i said i can't provide you with the exact error message as i don't have access to a web server at this time. (The database name is changed for security purpuses) I would have provided it earlier but i needed to get access to the server and download it...

<%
  'Designed by Paul Morgan
  'in February 2003
  'inserts record (email, name, and zip)
  'into database...


  'Connect to database
  dim conn
  set conn = Server.CreateObject("ADODB.Connection")
  conn.Mode = adModeReadWrite
  conn.Provider = "Microsoft.Jet.OLEDB.4.0"
  conn.Open "c:\inetpub\myfolder\databases\mydatabase.mdb"
 
  'Open the recordset
  dim rs
  set rs = Server.CreateObject("ADODB.Recordset")
  rs.Open "list", conn

  'Create and set variables from querystring
  dim fn
  dim zip
  dim email
  fn = Request.Querystring("fname")
  zip = Request.Querystring("zip")
  email = Request.Querystring("email")

  'Add the new record to the database
  rs.AddNew
    rs ("NameFirst") = fn
 rs ("zip") = zip
 rs ("EmailAddress") = email
  rs.Update
 
  'Clean up
  rs.Close
  conn = nothing
  rs = nothing
  fn = nothing
  zip = nothing
  email = nothing
%>

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

Joined: 10 April 2002
Location: Australia
Status: Offline
Points: 846
Post Options Post Options   Thanks (0) Thanks(0)   Quote Bunce Quote  Post ReplyReply Direct Link To This Post Posted: 04 March 2003 at 1:20am

You're not specifying a locktype here:

rs.Open "list", conn

Read here for info on how to do this:
http://www.adopenstatic.com/faq/jetcursortypes.asp
http://www.adopenstatic.com/faq/800a0bb9.asp#RecordsetOpenSyntax

Additonally, if you're not going to iterate through your recordset, then why create a recordset at all?

You could simply execute an INSERT statement through your existing connection. Something like:

strSQL = "INSERT INTO [YourTable] ('NameFirst','Email','Zip') VALUES (' & fn & "','" & zip & "','" & email & "')"

conn.execute(strSQL)

Cheers,
Andrew

There have been many, many posts made throughout the world...
This was one of them.
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.