# CFGRIDUPDATE

Used in a CFGRID, CFGRIDUPDATE allows you to perform updates to data sources directly from edited grid data. CFGRIDUPDATE provides a direct interface with your data source.

CFGRIDUPDATE first applies DELETE row actions followed by INSERT row actions and finally UPDATE row actions. Row processing stops if any errors are encountered.

### Syntax

    <CFGRIDUPDATE GRID="gridname"
        DATASOURCE="data source name"
        DBTYPE="type"
        DBSERVER="dbms"
        DBNAME="database name"
        TABLENAME="table name"
        USERNAME="data source username"
        PASSWORD="data source password"
        TABLEOWNER="table owner"
        TABLEQUALIFIER="qualifier"
        PROVIDER="COMProvider"
        PROVIDERDSN="datasource"
        KEYONLY="Yes/No">

#### GRID

Required. The name of the CFGRID form element that is the source for the update action.

#### DATASOURCE

Required. The name of the data source for the update action.

#### DBTYPE

Optional. The database driver type:

- ODBC (default) -- ODBC driver.
- Oracle73 -- Oracle 7.3 native database driver. Using this option, the ColdFusion Server computer must have Oracle 7.3.4.0.0 (or greater) client software installed.
- Oracle80 --Oracle 8.0 native database driver. Using this option, the ColdFusion Server computer must have Oracle 8.0 (or greater) client software installed.
- Sybase11 --Sybase System 11 native database driver. Using this option, the ColdFusion Server computer must have Sybase 11.1.1 (or greater) client software installed. Sybase patch ebf 7729 is recommended.
- OLEDB --OLE DB provider. If specified, this database provider overrides the driver type specified in the ColdFusion Administrator.
- DB2 --DB2 5.2 native database driver.
- Informix73--Informix73 native database driver.

#### DBSERVER

Optional. For native database drivers and the SQLOLEDB provider, specifies the name of the database server machine. If specified, DBSERVER overrides the server specified in the data source.

#### DBNAME

Optional. The database name (Sybase System 11 driver and SQLOLEDB provider only). If specified, DBNAME overrides the default database specified in the data source.

#### TABLENAME

Required. The name of the table you want to update. Note the following:

- ORACLE drivers -- This specification must be in uppercase.
- Sybase driver -- This specification is case-sensitive and must be in the same case as that used when the table was created

#### USERNAME

Optional. If specified, USERNAME overrides the username value specified in the ODBC setup.

#### PASSWORD

Optional. If specified, PASSWORD overrides the password value specified in the ODBC setup.

#### TABLEOWNER

Optional. For data sources that support table ownership (such as SQL Server, Oracle, and Sybase SQL Anywhere), use this field to specify the owner of the table.

#### TABLEQUALIFIER

Optional. For data sources that support table qualifiers, use this field to specify the qualifier for the table. The purpose of table qualifiers varies across drivers. For SQL Server and Oracle, the qualifier refers to the name of the database that contains the table. For the Intersolv dBase driver, the qualifier refers to the directory where the DBF files are located.

#### PROVIDER

Optional. COM provider (OLE-DB only).

#### PROVIDERDSN

Optional. Data source name for the COM provider (OLE-DB only).

#### KEYONLY

Optional. Yes or No. Yes specifies that in the update action, the WHERE criteria is confined to just the key values. No specifies that in addition to the key values, the original values of any changed fields are included in the WHERE criteria. Default is Yes.

### Example

    <!--- This example shows the CFGRID, CFGRIDCOLUMN, CFGRIDROW,
    and CFGRIDUPDATE tags in action --->
    ...
    <!--- If the gridEntered form field has been tripped,
    perform the gridupdate on the table specified in the database.
    Using the default value keyonly=yes allows us to change only
    the information that differs from the previous grid --->
    <CFIF IsDefined("form.gridEntered") is True>
    <CFGRIDUPDATE GRID="FirstGrid" DATASOURCE="cfsnippets"
      TABLENAME="CourseList"  KEYONLY="Yes">
    </CFIF>
    ...