ASA Programming Guide
ODBC Programming
ODBC samples
The sample program odbc.c, when compiled for versions of Windows that support services, runs optionally as a service.
The two files containing the example code for Windows services are the source file ntsvc.c and the header file ntsvc.h. The code allows the linked executable to be run either as a regular executable or as a Windows service.
To run the ODBC sample
Start the program:
Run the file Samples\ASA\C\odbcwnt.exe.
Choose a table:
Choose one of the tables in the sample database. For example, you may enter Customer or Employee.
To run the ODBC sample as a Windows service
Start Sybase Central.
In the left pane, select Adaptive Server Anywhere 9.
In the right pane, select the Services tab.
From the File menu, choose New
The Service Creation wizard appears.
On the first page, enter a name for the service.
On the second page, select Sample program.
On the third page, browse to the sample program (odbcwnt.exe) from the Samples\ASA\C subdirectory of your SQL Anywhere directory.
Complete the wizard to install the service.
Click Start on the main window to start the service.
When run as a service, the program displays the normal user interface if possible. It also writes the output to the Application Event Log. If it is not possible to start the user interface, the program prints one page of data to the Application Event Log and stops.