Copyright: ® Sylvain Faust Inc. (SFI)


Help Contents
Contents

Sample Application

Description

Installation

Logon

Mainform Processing

Add New Author

Change Author Info

Delete Existing Author

Exit Application


Description

The SQL-Sombrero/VBX comes with two sample applications. They are functionally similar. The first application "SAMPLE42" is for use with SQL Server versions 4.2x. The second application "SAMPLE10" is for use with SYBASE System 10 servers.

The application maintains the author table found in the pubs database in SQL Server versions 4.2x and the pubs2 database in SYBASE System 10 servers. The application allows the user to add new authors, change information about existing authors and to delete authors from the database. The code required to perform each of the above tasks is annotated with comments showing what the functionality of each of the DB-Library commands is and why that command is required to make the application function correctly.

All messages from the server are echoed back in a message box. This processing may be suppressed by changing the code. This feature is only to show what types of messages are sent by the server to the appellation in normal processing.


Installation

The files for each of the versions of the sample application are installed into separate directories. These directories are SAMPLE42 for the SQL Server version 4.2 sample application and SAMPLE10 for the Sybase System 10 sample application.

The following files are installed into the above directories when each sample application is installed. If both sample applications are installed then the files will be installed into each libarary. There are changes in the code in the MAINFORM.FRM Visual Basic code.

GBASS.BAS - variable declarations for application

GLOBAL.BAS - function declaration for SQL-Sombrero (DB-Library)

LOGON.FRM - Visual Basic form used to control logon to server

MAINFROM.FRM -Visual Basic form to control all other processing

SAMPLEXX.MAK - Visual Basic project file for sample application


Logon

When the application is first loaded the user is presented a screen with two command buttons.

They are labeled Logon and Exit. If the user presses the Exit button at any time during the running of the application the application will terminate. If the user presses the Logon button a dialog will appear asking the user to input the following screen:

UserId	- this is the user's id on the requested server

Password	- this is the password for the userid

Server Id	- the name of the SQL Server that you wish to connect to

Database	- the name of the database on the above server that contains the author table

Note 1:	The Server Id above must match an entry in the SQL Server section of the WIN.INI file on the user's workstation. This entry will contain information mapping the Server Id to a particular server on the network.

Note 2:	The application will give a warning if the user inputs a database name other than pubs for the SQL Server 4.2x version (APP1) or pubs2 fro the SYBASE System 10 version (APP2). This is only a warning and can be ignored.

There are two command buttons on this dialog. If the user fills in the information required and presses the Logon to Server button, the application will attempt to connect to the requested server with the userid and password provided. If the connection is made it will then attempt to change to the database which was input. The default databases for access to the authors table is explained above. If the user presses the Cancel button the dialog will close with no action and will return to the first screen with the Logon and Exit buttons.


Mainform Processing

Once the logon is complete the user will be switched back to the main form. At this time the form will now show the following screen:

- at the top a dropdown listbox containing the author id, last and first name of all the authors in the authors table.

- a caption indicating each column in the authors table

- a text box containing the data for each column in the authors table

- a frame containing three command buttons to allow the user to change information for an existing author, add a new author or delete an    existing author. When the form is first show only the Add New button is visible.

- a frame containing two buttons to control the execution of the commands

The dropdown list box contains the author id, last and first name of all the authors in the authors table. By selecting an entry from the list the complete column data for that author is shown in the textboxes. At this time those text boxes are not enabled so that the user may not change any information in those boxes. Once an author has been selected from the list the Change Info, and Delete Author buttons become visible.


Add New Author

This function allows the user to add a new author to the authors table.

Once this button has been pressed the Update Info , and Cancel buttons will be come visible. and the Change Info , Add New, and Delete Author buttons will be hidden. The user will then type in the requested information and press either the Update Info , or Cancel button. If the Update Info button is pressed then the application will add a new row to the authors table with the data input by the user. Pressing the Cancel button will cancel the operation and the data in the author fields will be restored back to what it was prior to pressing the Add New button.


Change Author Info

This function allows the user to change the information for  an existing author on the authors table.

Once this button has been pressed the Update Info , and Cancel buttons will be come visible. and the Change Info , Add New, and Delete Author buttons will be hidden. The user will then type in the requested information and press either the Update Info , or Cancel button. If the Update Info button is pressed then the application will update the row with the author id indicated in the author id field with the data input by the user. Pressing the Cancel button will cancel the operation and the data in the author fields will be restored back to what it was prior to pressing the Change Info button.


Delete Existing Author

  - This function allows the user to remove the information for  an existing author on the authors table.

Once this button has been pressed the Update Info , and Cancel buttons will be come visible. and the Change Info , Add New, and Delete Author buttons will be hidden. The user will then press either the Update Info , or Cancel button. If the Update Info button is pressed then the application will remove the row with the author id indicated in the author id field for the authors table. Pressing the Cancel button will cancel the operation and the data in the author fields will be restored back to what it was prior to pressing the Change Info button.


Exit Application

To exit the application the user will press the Exit button at any time.