ASA Programming Guide
Developing Applications with the .NET Data Provider
Once you have installed the Adaptive Server Anywhere .NET data provider, you must make two changes to your Visual Studio .NET project to be able to use it:
add a reference to the Adaptive Server Anywhere .NET data provider DLL
add a line to your source code to reference the Adaptive Server Anywhere .NET data provider classes
For information about installing and registering the Adaptive Server Anywhere .NET data provider, see Deploying the Adaptive Server Anywhere .NET data provider.
Adding a reference tells Visual Studio .NET which DLL to include to find the code for the Adaptive Server Anywhere .NET data provider.
To add a reference to the Adaptive Server Anywhere .NET data provider in a Visual Studio .NET project
Start Visual Studio .NET and open your project.
In the Solution Explorer window, right-click the References folder and choose Add Reference from the popup menu.
The Add Reference dialog appears.
On the .NET tab, click Browse to locate iAnywhere.Data.AsaClient.dll. (The default location is \Program Files\Sybase\SQL Anywhere 9\win32). Select the DLL and click Open.
Note that there is a separate version of the DLL for each of Windows and Windows CE.
For a complete list of installed DLLs, see Adaptive Server Anywhere .NET data provider required files.
You can verify that the DLL is added to your project. Open the Add Reference dialog and then click the .NET tab. iAnywhere.Data.AsaClient.dll appears in the Selected Components list. Click OK to close the dialog.
The DLL is added to the References folder in the Solution Explorer window of your project.
In order to use the Adaptive Server Anywhere .NET data provider, you must also add a line to your source code to reference the data provider. You must add a different line for C# than for Visual Basic .NET.
To reference the data provider classes in your code
Start Visual Studio .NET and open your project.
If you are using C#, add the following line to the list of using
directives at the beginning of your project:
using iAnywhere.Data.AsaClient;
If you are using Visual Basic .NET, add the following line at the beginning of your project before the line Public Class Form1
:
Imports iAnywhere.Data.AsaClient
This line is not strictly required. However, it allows you to use short forms for the Adaptive Server Anywhere classes. Without it, you can still use
iAnywhere.Data.AsaClient.AsaConnection conn = new iAnywhere.Data.AsaClient.AsaConnection()
instead of
AsaConnection conn = new AsaConnection()
in your code.