|
 |
access_asp thread: updatable query
Message #1 by "Alien Riedstra" <a.w.riedstra@l...> on Tue, 16 Jul 2002 10:24:28
|
|
Hello,
I'm trying to learn ASP via the book Beginning active Server Pages 3.0 and
I try to make the file SQLUpdate (chapter 14) work. It's an example of the
Command Object with the Update statement. I use the database wich is
provided by the book. The code looks like this:
<%
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>
I get the error: Microsoft OLE DB Provider for ODBC Drivers
error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable
query.
Does anybody know what's going wrong?
Thanks in advance,
Alien Riedstra
Message #2 by "Chris Kobsa" <ckobsa@a...> on Tue, 16 Jul 2002 08:29:37 -0400
|
|
Hi Alien,
This is not in answer to your question, but I am going through the same book
as you right now
and I am in Chapter 12, dealing with the movie access database. I am able to
access the database
through my asp-file. It keeps telling me that the database is already opened
by another user
and/or that I don't have permission to open it. I also get an "HTTP 500 -
Internal server error"-message.
Since you are already looking at Chapter 15 of the book, I assume you went
through Chapter 12 already,
and it worked for you. Do you what the problem is? Please advice.
Thanks and Ciao,
Chris
-----Original Message-----
From: Alien Riedstra [mailto:a.w.riedstra@l...]
Sent: Tuesday, July 16, 2002 10:24 AM
To: Access ASP
Subject: [access_asp] updatable query
Hello,
I'm trying to learn ASP via the book Beginning active Server Pages 3.0 and
I try to make the file SQLUpdate (chapter 14) work. It's an example of the
Command Object with the Update statement. I use the database wich is
provided by the book. The code looks like this:
<%
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>
I get the error: Microsoft OLE DB Provider for ODBC Drivers
error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable
query.
Does anybody know what's going wrong?
Thanks in advance,
Alien Riedstra
Message #3 by "Alien Riedstra" <a.w.riedstra@l...> on Tue, 23 Jul 2002 08:54:41
|
|
Hi Chris,
Yes I went through chapter 12 , but I didn't receive that message. If you
use the exmaple code from the wrox-site, then maybe your read/write
permissions are not set correctly? Otherwise, maybe there's an error in
your code?
Good luck! Alien
> Hi Alien,
This is not in answer to your question, but I am going through the same
book
as you right now
and I am in Chapter 12, dealing with the movie access database. I am able
to
access the database
through my asp-file. It keeps telling me that the database is already
opened
by another user
and/or that I don't have permission to open it. I also get an "HTTP 500 -
Internal server error"-message.
Since you are already looking at Chapter 15 of the book, I assume you went
through Chapter 12 already,
and it worked for you. Do you what the problem is? Please advice.
Thanks and Ciao,
Chris
-----Original Message-----
From: Alien Riedstra [mailto:a.w.riedstra@l...]
Sent: Tuesday, July 16, 2002 10:24 AM
To: Access ASP
Subject: [access_asp] updatable query
Hello,
I'm trying to learn ASP via the book Beginning active Server Pages 3.0 and
I try to make the file SQLUpdate (chapter 14) work. It's an example of the
Command Object with the Update statement. I use the database wich is
provided by the book. The code looks like this:
<%
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>
I get the error: Microsoft OLE DB Provider for ODBC Drivers
error '80004005'
[Microsoft][ODBC Microsoft Access Driver] Operation must use an updateable
query.
Does anybody know what's going wrong?
Thanks in advance,
Alien Riedstra
|
|
 |