Customer Login  .   Webmail Login  .   About Us  .   Contact Us
Go to: Articles List

How to update a database record:

'Do database connection
'Declare variables
sql = "update MyTable set"
sql = sql & "Field1 = '" & VAR1 & "',"
sql = sql & "Field2 = '" & VAR2 & "',"
sql = sql & "Field3 = '" & VAR3 & "' "
sql = sql & "where Field4 = '" & VAR4 & "'"
Conn.Execute(sql)

The first thing that this code does is point to the table that is going to be updated. In this case it is a table that is called MyTable. You will need to rename this to the name of the table you are trying to update. FieldX is the actual name of the field that you are working with, so don't forget to change those.

Notice that the last column to be updated has a " " at the end instead of a ",". Then the last line tells the script exactly what record to update. Here is another example of what the "where Field4 = " line could be:

sql = sql & "Where MemberUserId = '" & MemberId & "'"

By: Josh Olson
Shared Hosting
Rookie
Pro
Advanced
Dedicated Servers
BASE
BUSINESS
ENTERPRISE
Why Choose Brinkster?
Radical Support
Brinkster Datacenter
Brinkster Network
Corporate Social Responsibility
90 Day Money Back Guarantee
Unsurpassed Value
Client Testimonials
Additional Features
Antivirus
Merchant Account
E-Commerce
Live Chat Communicator
Free Firewall
Website Builder
Free Web Hosting
Support
General Support
Codebank Search
Forums
Articles
Click here for Brinkster Live Chat
Home   Domains   Shared Hosting   Dedicated Hosting   Partner   Support   About Us    Contact Us   Webmail
Copyright © Brinkster Communications Corporation All Rights Reserved. Privacy Policy & Legal