Wednesday, October 09, 2013

Connecting to SQL Anywhere 16 using Visual Studio 2013 RC for Web

You can look at the sample described in this post to see how easy it is to connect to SQL Anywhere from Microsoft VS2013RC-Web.

When you install SQL Anywhere 16 a sample folder is installed in the following location:

C:\Users\Public\Documents\SQL Anywhere 16\Samples

Among the various samples you will find the ADO.NET folder here:

C:\Users\Public\Documents\SQL Anywhere 16\Samples\SQLAnywhere

There are a couple of examples that show how to work with SQL Anywhere 16 using ADO.NET. This post shows looking at the TableViewer sample.

  • Launch VS2013RC_Web and open the console application TableViewer solution file.
  • The project gets upgraded should you choose to do so and you should see a message as shown.
  • Click OK and you get a migration report. Make sure you look at all the message links.

  • The project gets upgraded as shown.

The project should bring up a form and the button events are shown on the right. Clicking any of the button events and you should get  to see the code.

The project when run displays a form containing a couple of buttons and the connection string shows up in one of text boxes (of course this assumes that you have already started the SQL Anywhere 16 Personal demo server).

  • Click Connect and the list of tables gets populated as shown.

  • Choose a table from the drop-down and click Execute. Execute button instantiates a DataReader and the readers reads all the items. You will see all the columns in the table as shown.

Make sure you read the code.

Microsoft Visual Studio 2013 RC_web is an excellent (free) program that you should really check out.

No comments: Protection Status