Change Handlers Using SQL
You can use SQL commands to validate user input and save data changes to a database on cell changes.
You can define such handlers in the xls.handlers table for all columns or only the required columns.
Here is a sample of column-level handlers:
ID | TABLE_SCHEMA | TABLE_NAME | COLUMN_NAME | EVENT_NAME | HANDLER_SCHEMA | HANDLER_NAME | HANDLER_TYPE | HANDLER_CODE |
---|---|---|---|---|---|---|---|---|
s02 | view_cashbook3 | date | Change | s02 | usp_cashbook3_date_change | CODE | UPDATE s02.cashbook SET [date] = @cell_date_value WHERE id = @id | |
s02 | view_cashbook3 | account_id | Change | s02 | usp_cashbook3_account_id_change | CODE | UPDATE s02.cashbook SET account_id = @cell_number_value WHERE id = @id | |
s02 | view_cashbook3 | item_id | Change | s02 | usp_cashbook3_item_id_change | CODE | UPDATE s02.cashbook SET item_id = @cell_number_value WHERE id = @id | |
s02 | view_cashbook3 | company_id | Change | s02 | usp_cashbook3_company_id_change | CODE | UPDATE s02.cashbook SET company_id = @cell_number_value WHERE id = @id | |
s02 | view_cashbook3 | debit | Change | s02 | usp_cashbook3_debit_change | CODE | UPDATE s02.cashbook SET debit = @cell_number_value WHERE id = @id | |
s02 | view_cashbook3 | credit | Change | s02 | usp_cashbook3_credit_change | CODE | UPDATE s02.cashbook SET credit = @cell_number_value WHERE id = @id |
You can use such handlers even in SQLite and SQL Server Compact.
Note that SQL Server, SQL Server Compact, and SQLite use parameters with the @ character as a prefix while other database platforms use the colon like :cell_value.