My ASP Tutorials - Updating a Database Example:
Working With Databases -- The Update Statement:
The next task you want to become familiar with after mastering the insert statement, is the update statement. What
this statement does is allow the user to update a record in one or multiple tables within a given database. In this example
we are modifying one pieces of information in a single table. In order to complete this task you have to connect to the
database, retrieve the information you want to update, know the table name(s) and column name(s) that correspond to the
data you wish to update, and make sure that the variable types you have for each value match their partner within the table.
Refer to the example below for a visual explanation of the insert statement.
<%
Dim strSQL
strSQL = "SELECT * FROM TableName WHERE DatabaseVariable1 = " & Variable1
Set rsCat = dcnDB.execute(strSQL)
strSQL = "UPDATE TableName SET DatabaseVariable2 = '"&Variable2 & "'" _
& " WHERE DatabaseVariable3 = " & Variable3
Set rsCat = dcnDB.execute(strSQL)
strSQL = "SELECT * FROM TableName WHERE DatabaseVariable1 = " & Variable1
Set rsCat = dcnDB.execute(strSQL)
%>