User Tools

Site Tools


tplcontroladosavebutton.htm
Navigation:  Templates > Guide to all Templates > Control Templates >====== ADO Save Button Control Template ====== Previous pageReturn to chapter overviewNext page

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.

ADOSaveBut_shg.jpgadosaveclassesadosavecolumnsadosavegeneral

General Tab

Connection Group:

Connection Object

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.

New Connection

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.

Command Object

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.

For example,

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.

Columns Tab

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.

SQL Tab

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.

Regenerate SELECT

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).

Classes Tab

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.

tplcontroladosavebutton.htm.txt · Last modified: 2021/04/15 15:57 by 127.0.0.1