This tutorial is based on the Simple project that is included with SQL Anywhere.
The complete application can be found in your SQL Anywhere samples directory at samples-dir\SQLAnywhere\ADO.NET\SimpleWin32.
For information about the default location of samples-dir, see Samples directory.
The Simple project illustrates the following features:
For more information about how the sample works, see Understanding the Simple sample project.
Start Visual Studio.
Choose File » Open » Project.
Browse to samples-dir\SQLAnywhere\ADO.NET\SimpleWin32 and open the Simple.sln project.
When you use the SQL Anywhere .NET Data Provider in a project, you must add a reference to the Data Provider DLL. This has already been done in the Simple code sample. You can view the reference to the Data Provider DLL in the following location:
In the Solution Explorer window, open the References folder.
You should see iAnywhere.Data.SQLAnywhere in the list.
For instructions about adding a reference to the Data Provider DLL, see Adding a reference to the Data Provider in your project.
You must also add a using
directive to your source code to reference the Data Provider classes. This has already been done in the Simple code sample.
To view the using
directive:
Open the source code for the project. In the Solution Explorer window, right-click Form1.cs and choose View Code.
In the using
directives in the top section, you should see the following line:
using iAnywhere.Data.SQLAnywhere; |
This line is required for C# projects. If you are using Visual Basic .NET, you need to add an Imports
line to your source code.
Choose Debug » Start Without Debugging or press Ctrl+F5 to run the Simple sample.
In the SQL Anywhere Sample window, click Connect.
The application connects to the SQL Anywhere sample database and puts the last name of each employee in the window, as follows:
Click the X in the upper right corner of the screen to shut down the application and disconnect from the sample database. This also shuts down the database server.
You have now run the application. The next section describes the application code.
Understanding the Simple sample project
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |