Please enable JavaScript to view this site.

Navigation: Advanced topics > Programming topics > Database API > Methods

Database API: Update

Scroll Prev Next More

 

Updates records in the database. The Update method overwrites existing records in the database instead of adding new ones.

 

Note: the third parameter must be specified for the method to be executed successfully.

Syntax

 

DB_Update table, data, keyvalues
' or
DB_Update table, data, where

Arguments

table

the table where you want to update the data.

data

an array of values that overwrites the existing record.

keyvalues

an array of key values that define the condition for the Update query.

where

the condition for the Update query.

Return value

No return value.

Example

 

' Update the record with id=50 in the 'Cars' table
 
Dim data
Dim keyvalues
Set data = CreateDictionary()
Set keykeyvalues = CreateDictionary()
data("make") = "Toyota"
data("type") = "RAV4"
data("price") = 16000
keyvalues("id") = 50
DB_Update "Cars",data,keyvalues

 

Alternative syntax:

 

' Update a record in the 'Cars' table where id=50
 
Dim data
Set data = CreateDictionary()
data("make") = "Toyota"
data("type") = "RAV4"
data("price") = 16000
DB_Update "Cars",data,"id=50"

See also:

Database API: Insert()

Database API: Delete()

Database API: Select()

About Database API