Connecting to a SQL Database

Description

How to define a connection to a SQL database, procedural steps included.

The Connect to SQL Database action allows you define a connection to a SQL database (including Excel). Alpha Anywhere will use AlphaDAO (the Alpha Anywhere Data Access Objects) to connect to the remote database. You can connect to any database for which Alpha Anywhere has native drivers, or for which an ODBC driver is available. Once you have opened a connection to the SQL database, you can execute other actions that select, update, insert, and delete records in the SQL database.

To open the Script Genie: Connect to SQL Database option from the Control Panel first click on the Code tab, then click the New at the top of the Control Panel. Move the cursor down the cascading list and click on the Script (using Action Scripting) option.

Click on the Add New Action button in the top left-hand corner of the Code Editor when it loads and the Select Action Dialog will appear. In the Category list on the left of the Select Action Dialog click on the SQL(using AlphaDAO) option. From the Action list on the right side of the Select Action Dialog choose the Connect to SQL Database action.

 Procedure

  1. Enter the name of the variable that will be created to reference the connection to the SQL database in the Variable name control.

  2. Select the scope of this variable from the Variable scope list. The options are:

    • "Local" - visible only to this Action Script

    • "Shared" - the variable is available to scripts based on the underlying form or browse

    • "Global" - the variable is available to other scripts

  3. Enter the required connection string into the Connection string control. If you do not have a ready-made connection string, you may click Build to display the Create SQL Connection String dialog.

  4. Optionally, click Test Connection to verify that the connection string was properly defined.

  5. Click Next >.

  6. Optionally, enter a comment that describes the action.

  7. Click Finish.