|Navigation: Templates > Guide to all Templates > Control Templates >====== ADO Save Button Control Template ======
The ADO Save Button Control Template is used to update a series of data elements through an ADO connection. There are several option that are unique and different from the standard Save Button used in ISAM and SQL database updates.
In the Save Button properties (found on the button's Actions tab control) press the ADO/SQL Behavior button to access the ADO/SQL Behavior dialog. The following prompts are available.
Choose a Connection object name from the drop list provided. This list should contain the connection object you created in the ADO Global support template.
Use a New Connection
If you do not wish to use any of the Global Connections that are available, check this box to create a new connection specifically for this browse box.
Press this button to call the Connection Builder. You also have the option to create (derive) a new Connection object to use instead of the global object; check the Generate a COMIniter object check box to enable this feature.
The ADO connection layer contains a default command object that is responsible for handling the appropriate data update behavior. If you need to select an alternative object name, enter the value here.
ADO Error Handling
Specify an Error handler Procedure
Check this box if you would like to call an Error Handling procedure if any connection problem is noticed during the Save process. Select a procedure name, or enter a new one in the drop list provided.
Table Mapper ' BASETABLENAME is not supported
Check this box if your ADO data source does not support BASETABLENAME capability.
In ADO, when you have created a SELECT statement through your template design that contains the same column name, but coming from a different table, the fields' collection will have field objects with the same name.
SELECT Customer.SysID, order.SysId etc'
The Fields collection above will have 2 Field objects with the name SysID. In order to make sure that the values from those 2 fields will go into the right application variable, we need to know which table the field belongs to. There is a property in the Field properties collection called BASETABLENAME that provide this value.
The Columns tab control prompts are used to specify additional columns (fields) that need to be updated by the ADO Form, but are not populated on the window.
By default, all data elements populated on the window that are part of the ADO file will be automatically updated as needed.
Get records affected?
Check this box if you want to retrieve the number of records affected after an update command is issued by the ADO command object. This number will be the same number you would see if you issued an SQL update command and the backend responded with “x records were affected by the command.
In most cases, the records affected variable will return a 1 if the update to the ADO table was successful. A zero (0) will be returned if the update to the ADO table was not successful.
Records affected var
Select a variable name to store and process the Records Affected count.
Additional Columns to add in SQL statement
In addition to the fields (columns) populated on the ADO Form procedure window, you can add additional columns to update here. For example, you may need to add data to selected columns based on data entered on the form, but need to do it in source and hide it from the user.
Override Generated SELECT
Check this box to bypass the auto generation of the SELECT statement by the templates. Your custom statement will be substituted in its place. This box also enables the Regenerate SQL button, should you wish to reset the statement back to its original value.
Press this button to reset the original template-constructed SQL statements. This is useful should you need to start from scratch again before customizing your statements. Only enabled when the next prompt is active (checked).
The Classes Tab contains information regarding the names of classes used by the ADO form templates. For more information, see Classes Tab.
Help on the other Save button prompts are identical to the standard Save Button control template, and can be referenced there.