Modifying Records
To modify one or more existing record, you use the UPDATE statement. To use
this command, you state the table to update, the values you want fields to be
changed to, and, what records to be changed. For example,
UPDATE Users SET UserName = 'James Smith', Password = 'NEWPASSWORD'
WHERE UserID = 10
In this case, all records which had a UserID of 10 would have their
UserName and Password fields changed to the values given. If you only want one
record to be updated, you need to ensure that in the WHERE clause, you specify
a condition that will only return one record. This would normally be a unique
id/primary key field.
Note that you do not have to include all the fields for the record.
If you want to update more than one record, you simply change the condition
specified in the WHERE clause. For example,
UPDATE Furniture SET Price = 10 WHERE ItemType = 'Cupboard'
would change the Price field to 10 for all records in the Furniture table where
their ItemType field had was "Cupboard".
-
Posted by zible on 24 Jan 2007
This seems simple, yet I can't find how you do this. I need to run a query in VB on a very simple database. There is the possibility that the query would be unsuccessfull, and if so I need to do ot...
-
Posted by darshan on 25 Apr 2005
you need to fire sql statement like this
select idno, name, email, return from [table_name] where [your_condition]
this will return record set lets say "rs" is object of recordset
then you will n...
-
Posted by Abzmoh2007 on 11 Mar 2004
Basically am trying to search a database by getting an input from the users selection on a list.
the list contains names of countries and when i click that search button, how can i get the result of...
-
Posted by NightChillz on 23 Dec 2003
hey, i see how i can fill a datagrid with data from an sql table, but i am having trouble figuring out how to do the exact opposite, take data from a datagrid and fill an sql table with it/overriding ...
-
Posted by tomoko on 26 Nov 2003
hi,
pls help as i'm new in asp. i'm developing the administrative part of a website for my project. i'm having trouble with the "updating data" part. for example, i have done the 'add staff' and "de...