The SQL Anywhere .NET Data Provider can be used to develop applications with Visual Studio 2005 or later versions. To use the SQL Anywhere .NET Data Provider, you must include two items in your Visual Studio project:
a reference to the SQL Anywhere .NET Data Provider DLL
a line in your source code referencing the SQL Anywhere .NET Data Provider classes
These steps are explained below.
For information about installing and registering the SQL Anywhere .NET Data Provider, see Deploying the SQL Anywhere .NET Data Provider.
Adding a reference tells Visual Studio which DLL to include to find the code for the SQL Anywhere .NET Data Provider.
Start Visual Studio and open your project.
In the Solution Explorer window, right-click References and choose Add Reference.
On the .NET tab, click Browse to locate iAnywhere.Data.SQLAnywhere.dll. Note that there are separate versions of the DLL for each of Windows and Windows Mobile platforms.
For the Windows SQL Anywhere .NET Data Provider, the default location is install-dir\Assembly\v2.
For the Windows Mobile SQL Anywhere .NET Data Provider, the default location is install-dir\ce\Assembly\v2.
Select the DLL and then click Open.
For a complete list of installed DLLs, see SQL Anywhere .NET Data Provider required files.
You can verify that the DLL is added to your project. Open the Add Reference window and then click the .NET tab. iAnywhere.Data.SQLAnywhere.dll appears in the Selected Components list. Click OK to close the window.
The DLL is added to the References folder in the Solution Explorer window of your project.
To assist with the use of the SQL Anywhere .NET Data Provider namespace and the types defined in this namespace, you should add a directive to your source code.
Start Visual Studio and open your project.
Add the following line to 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.SQLAnywhere; |
If you are using Visual Basic, add the following line at the beginning of your project before the line Public Class Form1
:
Imports iAnywhere.Data.SQLAnywhere |
This directive is not required, however, it allows you to use short forms for the SQL Anywhere .NET classes. For example:
SAConnection conn = new SAConnection() |
Without this directive, you can still use the following:
iAnywhere.Data.SQLAnywhere.SAConnection conn = new iAnywhere.Data.SQLAnywhere.SAConnection() |
Discuss this page in DocCommentXchange. Send feedback about this page using email. |
Copyright © 2009, iAnywhere Solutions, Inc. - SQL Anywhere 11.0.1 |