Use the SQL Anywhere .NET Data Provider to develop .NET applications with Visual Studio by including both a reference to the SQL Anywhere .NET Data Provider, and a line in your source code referencing the SQL Anywhere .NET Data Provider classes.
There are no prerequisites for this task.
Context and remarks
Start Visual Studio and open your project.
In the Solution Explorer window, right-click References and click Add Reference.
The reference indicates which provider to include and locates the code for the SQL Anywhere .NET Data Provider.
Click the .NET tab, and scroll through the list to locate any of the following:
There is separate version of the provider for Windows Mobile platforms. For the Windows Mobile SQL Anywhere .NET Data Provider, click the Browse tab and locate the Windows Mobile version of the provider. The default location is %SQLANY12%\CE\Assembly\V2.
Click the desired provider and then click OK.
The provider is added to the References folder in the Solution Explorer window of your project.
Specify a directive to your source code to assist with the use of the SQL Anywhere .NET Data Provider namespace and the defined types.
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:
If you are using Visual Basic, add the following line at the beginning of your project before the line
Public Class Form1:
The following example illustrates code that can be used to establish a database connection when a directive is specified:
SAConnection conn = new SAConnection();
The following example illustrates code that can be used to establish a database connection when a directive is not specified:
iAnywhere.Data.SQLAnywhere.SAConnection conn = new iAnywhere.Data.SQLAnywhere.SAConnection();
Discuter à propos de cette page dans DocCommentXchange.
|Copyright © 2012, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.1|