Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - Programming » Tutorial: Develop a Simple Application in Visual Basic

Tutorial: Develop a Simple Application in Visual Basic Next Page

Introduction to Visual Basic tutorial


This tutorial is based on Visual Basic 6.0. The complete application can be found in the Visual Basic project samples-dir\SQLAnywhere\VBStarter\Starter.vbp.

Visual Basic provides several data access technologies. In this tutorial, you use the Microsoft ADO Data Control with the SQL Anywhere OLE DB provider to access the SQL Anywhere sample database from Visual Basic.

To develop a database application with Visual Basic
  1. Start Visual Basic, choosing a Standard Executable project.

  2. Add the Microsoft ADO Data Control 6.0 to your tool palette:

  3. Add the ADO Data Control to the form, as follows:

  4. Configure the ADO Data Control:

    Property

    Value

    CommandType

    2 - adCmdTable

    ConnectionString

    Provider=SAOLEDB;DSN=SQL Anywhere 10 Demo

    CursorLocation

    2 - adUseServer

    CursorType

    2 - adOpenDynamic

    RecordSource

    Employees

    The ConnectionString uses the SQL Anywhere OLE DB Provider (SAOLEDB) to connect to the "SQL Anywhere 10 Demo" data source. The cursor settings take advantage of SQL Anywhere server-side cursors rather than using client-side cursors.

  5. Add two text boxes to the form, as follows:

  6. Bind the text boxes to the ADO Data Control:

  7. Save the project.

  8. Run the sample:

    You have now created a simple Visual Basic application that works with ADO and the SQL Anywhere OLEDB provider.