SqlUpdate



This command updates data in a SQLite database. It comes in three different forms to allow flexibility in parameter format.
In all of the forms (n) is the database number, (table$) is the name of the table and (where$) is the SQLite where clause which selects the records to be updated.

SqlUpdate n, table$, where$, col1$, val11$ {, col2$, val2$...}

In this form the column names and values are paired one after another.

SqlUpdate 1, "People", "FirstName='Will' AND LastName = 'Robinson'", "Age","13"


SqlUpdateI n, table$, where$, ItemizedCols$, ItemizedVals$ {,delimiter$}

In this form the column names and values are stored as a delimited (Itemized) stings. The delimiter character is optional and will default to a comma if not specified.

columns$ = "LastName,Age"

values$ = "Smith,28"

SqlUpdateI 1, "People", "FirstName='Judy' AND LastName = 'Robinson'", columns$, values$

or

SqlUpdateI 1, "People", "FirstName='Judy' AND LastName = 'Robinson'", "LastName-Age", "Smith-28", "-"

Delimited Strings


Working with Arrays

SqlUpdateA n, table$, where$, columns$(), values$()

In this form the column names and values are stored in two arrays.

Dim columns$(1) = "LastName", "Age"

Dim values$(1) = "West", "19"

SqlUpdateA 1, "People", "FirstName='Penny' AND LastName = 'Robinson'", columns$(), values$()

The array values$() may also be a two dimensional array where the records are arranged values$(rows,columns). Here each row refers to a record and the columns is the index the specified columns$() array.

For example:

Dim columns$(3) = "FirstName", "LastName", "Age", "Sex"
Dim values$(1,3)

values$(0,0) = "Penny"
values$(0,1) = "Robinson"
values$(0,2) = "16"
values$(0,3) = "F"

values$(1,0) = "Judy"
values$(1,1) = "Robinson"
values$(1,2) = "26"
values$(1,3) = "F"

SqlUpdateA 1, "People", "", columns$(), values$()





SqlOpen


SqlClose


SqlAddTable


SqlDelTable


SqlInsert


SqlDelete


SqlExec


SqlGetTableNames$(n)


SQLite Cursor






Become a Patron