Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > Classic ASP Databases
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 18th, 2012, 02:58 PM
Friend of Wrox
Points: 1,035, Level: 12
Points: 1,035, Level: 12 Points: 1,035, Level: 12 Points: 1,035, Level: 12
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: , , USA.
Posts: 196
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to jmss66
Default Update a record using Prepared Statement

I am trying to include Prepare Statement in my program and so far I have learned how to do a select statement with parameter. Next I am trying to update a record but keep getting the error messge below:



Microsoft JET Database Engineerror '80004005'
Operation must use an updateable query. /development/CheckLogin.asp, line 102

Here is my code where I am updating using Prepared Statement. I don't even know if how I am using prepared statement is correct.

Code:
 
 
   Set objCmd = Server.CreateObject("ADODB.command")
   set rsUsers = Server.CreateObject("ADODB.Recordset")
   objCmd.ActiveConnection = objConn
   objCmd.Prepared = True
   objCmd.CommandType = adCmdText
   objCmd.CommandText = "UPDATE Member SET LastLogin = ?"
   objCmd.Parameters.Append(objCmd.CreateParameter("@LastLogin", adDate, adParamInput, Len(Now()), Now()))
    rsUsers.CursorType = adOpenKeyset
    rsUsers.LockType = adLockOptimistic
    objCmd.Execute()

Below is my code for the Select Statement which is doing fine. This one executes before the code above which I am having a problem with..

Code:
Dim rsUsers
Set objCmd = Server.CreateObject("ADODB.command")
set rsUsers = Server.CreateObject("ADODB.Recordset")
objCmd.ActiveConnection = objConn
objCmd.Prepared = True
objCmd.CommandType = adCmdText
objCmd.CommandText = "SELECT * FROM Member WHERE SSN = ?"
objCmd.Parameters.Append(objCmd.CreateParameter("@SSN", adChar, adParamInput, Len(strSSN), strSSN))
rsUsers.CursorType = adOpenKeyset
rsUsers.LockType = adLockOptimistic
rsUsers.Open = objCmd.Execute()
Please I am new to using Prepared Statement and asking for any assistance.
Thanks.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Prepared Statement jmss66 Classic ASP Basics 3 April 17th, 2012 12:38 PM
update multiple columns in an update statement debbiecoates SQL Server 2000 1 August 17th, 2008 04:01 AM
prepared statement sanqry J2EE 0 April 16th, 2006 02:58 AM
problem in prepared Statement abhit_kumar Java Databases 2 March 23rd, 2006 09:34 AM
problem in prepared statement abhit_kumar JSP Basics 1 November 25th, 2004 04:22 AM



All times are GMT -4. The time now is 05:03 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.