Manually Inserting UX Component Data into a SQL Database Using Xbasic
Xbasic can be used to manually submit data collected using the UX Component to a SQL database. This example demonstrates how this can be done.
As before, we must first create an appropriate database. For our example, we'll use Microsoft SQL Server; you can use any SQL database you have available, including Microsoft Access. Since we already have the table structure in Alpha Five, this is a very easy process.
First, go into your SQL database and create a new table. We created a new database named soldier using Microsoft SQL Server Management Studio. Then go to Alpha and create and then run an export operation from the soldier DBF table through a new AlphaDAO connection string (named soldier) to the soldier SQL table.
Now the SQL Server has a table soldier within a database soldier, which we can access through the named connection string soldier.
Note that this process will not create indexes or a primary key. You can add an auto-incremented ID field to the table and make it the primary key if you wish. You can also add indexes for any field or combination of fields. This will not require any of the following code to change, since auto-incremented fields are not included in INSERT statements.
Alternatively, just create the table, primary key, and indexes directly in SQL Server Management Studio or your database design tool of choice. You'll still need to create a connection string in Alpha Anywhere.
The code to handle the afterDialogValidate event is now: