Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Update Error - in Access


Message #1 by FRANS123@a... on Sun, 7 Apr 2002 16:07:15 EDT
--part1_183.65d2e1f.29e200f3_boundary
Content-Type: text/plain; charset="US-ASCII"
Content-Transfer-Encoding: 7bit

Hi -
I am a VB programmer that wants to learn more about ASP.

I hope someone can help me resolve the error message I got off the book I 
just purchased "Beginning ASP 3.0 - Chapter 14 - Page 580 - on Update Query - 
SQLUpdate.asp"

I am using a laptop with MS Windows 2000 server O/S and Access 2000.

Here is the error message when I ran the code off the internet explorer:

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query. (????????)
/BegASP/Chapter14/SQLUpdate.asp, line 22

I checked the access file "Movie2000.mdb" thatthe read only permission is 
unchecked.

Here is the file - SQLUpdate.asp I downloaded off the web site:
<%
  Option Explicit
  Dim strConnect
%>
<!-- #include file="DataStore.asp" -->
<!-- METADATA TYPE="typelib" 
              FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -->
<HTML>
<HEAD>
<TITLE>Using SQL's UPDATE Command and the ADO Command Object</TITLE>
</HEAD>
<BODY>
<% 
  Dim objComm, intNoOfRecords
  Set objComm = Server.CreateObject("ADODB.Command")

  Response.Write "<B>Harry the Ham directs Tarantino films? </B><BR>"
  objComm.ActiveConnection = strConnect
  objComm.CommandText="UPDATE AllMovies SET Director = 'Harry the Ham' " & _
                      "WHERE Director LIKE 'Quentin Tarantino'"
  objComm.CommandType=adCmdText
  objComm.Execute intNoOfRecords
  Response.Write "This UPDATE command has affected " & _ 
                   intNoOfRecords & " records<BR><BR>" 

  Response.Write "<B>Tarantino returned to his rightful place as director:</B>
 <BR>"
  objComm.CommandText="UPDATE AllMovies SET Director = 'Quentin Tarantino' " &
 _
                      "WHERE Director LIKE 'Harry the Ham'"
  objComm.Execute intNoOfRecords
  Response.Write "This UPDATE command has affected " & _ 
                  intNoOfRecords & " records<BR><BR>" 
  Set objComm = Nothing
%>
</BODY>
</HTML>

Any suggestion would be greatly appreciated.
~Frank W


Message #2 by "Stephen Proctor" <steveproctor@c...> on Mon, 8 Apr 2002 02:38:01
Frank,

I'm a beginner, but I've gotten this error message before.  Usually it's 
been a problem with the ADO contstants.  Please check your path to 
msado15.dll in your C drive.

Sometimes what's worked for me is to declare the constants, rather than 
use an include file or dll.  For you, try inserting the following in your 
ASP code where you dim the variables:

Const adLockReadOnly = 1
Const adCmdText = &H0001
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adCmdTable = &H0002

Then delete the msado15.dll reference.

These constants are more than you need, but may be better than an include 
file.  

Steve

Hi -
I am a VB programmer that wants to learn more about ASP.

I hope someone can help me resolve the error message I got off the book I 
just purchased "Beginning ASP 3.0 - Chapter 14 - Page 580 - on Update 
Query - 
SQLUpdate.asp"

I am using a laptop with MS Windows 2000 server O/S and Access 2000.

Here is the error message when I ran the code off the internet explorer:

Error Type:
Microsoft JET Database Engine (0x80004005)
Operation must use an updateable query. (????????)
/BegASP/Chapter14/SQLUpdate.asp, line 22

I checked the access file "Movie2000.mdb" thatthe read only permission is 
unchecked.

Here is the file - SQLUpdate.asp I downloaded off the web site:
<%
  Option Explicit
  Dim strConnect
%>
<!-- #include file="DataStore.asp" -->
<!-- METADATA TYPE="typelib" 
              FILE="C:\Program Files\Common Files\System\ado\msado15.dll" -
->
<HTML>
<HEAD>
<TITLE>Using SQL's UPDATE Command and the ADO Command Object</TITLE>
</HEAD>
<BODY>
<% 
  Dim objComm, intNoOfRecords
  Set objComm = Server.CreateObject("ADODB.Command")

  Response.Write "<B>Harry the Ham directs Tarantino films? </B><BR>"
  objComm.ActiveConnection = strConnect
  objComm.CommandText="UPDATE AllMovies SET Director = 'Harry the Ham' " & 
_
                      "WHERE Director LIKE 'Quentin Tarantino'"
  objComm.CommandType=adCmdText
  objComm.Execute intNoOfRecords
  Response.Write "This UPDATE command has affected " & _ 
                   intNoOfRecords & " records<BR><BR>" 

  Response.Write "<B>Tarantino returned to his rightful place as 
director:</B>
 <BR>"
  objComm.CommandText="UPDATE AllMovies SET Director = 'Quentin 
Tarantino' " &
 _
                      "WHERE Director LIKE 'Harry the Ham'"
  objComm.Execute intNoOfRecords
  Response.Write "This UPDATE command has affected " & _ 
                  intNoOfRecords & " records<BR><BR>" 
  Set objComm = Nothing
%>
</BODY>
</HTML>

Any suggestion would be greatly appreciated.
~Frank W



  Return to Index