LoudASP Knowledge Base - ASP and Database
Active Server Page knowledge dealing with databases
Easy SQL Help (Update)
Updating records in a database via SQL is simple once you get the hang of it.
SQLUpdate = "Update MYTABLE "
SQLUpdate = SQLUpdate & "SET MyColumn1 = '" & VAR1 & "',"
SQLUpdate = SQLUpdate & "MyColumn2 = '" & VAR2 & "' "
SQLUpdate = SQLUpdate & " where ID = '" & VAR_ID & "'"
This code will take VAR1, VAR2 and update the records located at MyColumn1
and MyColumn2 where ever the ID column equals VAR_ID.
Some thing to remember
The first line needs to be: Update YourTable
The second line needs to be: Set Column to something
The second to the last line need to end with a space not a comma
You could take this code above change the variables and drop it into a database
connection execution statment: conntemp.execute(SQLUpdate)
This FAQ has been read 9077 times.
How to Connect to a Database (DSNLESS)
Easy SQL How To (Insert)
Easy SQL Help (Update)
Easy SQL Help (Delete)
Easy SQL Apostrophes Bug Fix
Easy How To SQL (Select)
Database test for no records
|