Understanding the Table Viewer sample project

This section illustrates some key features of the SQL Anywhere .NET Data Provider by walking through some of the code from the Table Viewer code sample. The Table Viewer project uses the SQL Anywhere sample database, demo.db, which is held in your SQL Anywhere samples directory.

For information about the location of the SQL Anywhere samples directory, see Samples directory.

For information about the sample database, including the tables in the database and the relationships between them, see SQL Anywhere sample database.

In this section the code is described a few lines at a time. Not all code from the sample is included here. To see all the code, open the sample project in %SQLANYSAMP12%\SQLAnywhere\ADO.NET\TableViewer.

 Declaring controls
 Declaring a connection object
 Connecting to the database
 Defining a query
 Displaying the results
 Error handling