longmatch
Programmer
- Nov 1, 2001
- 406
I just copy the code from website for "Beginning Active Server Pages". It did not work. I have run other code access the database (movies2000.mdb), it works fine. Anybody knows what is wrong?
Thanks
Haijun
<%
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"![Wink ;) ;)](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
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>
Thanks
Haijun
<%
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>