Tutorial: Using the Simple code sample

The Simple project illustrates the following features:

For more information about how the sample works, see “Understanding the Simple sample project”.

Steps Running the Simple code sample in Visual Studio .NET

  1. Start Visual Studio .NET.

  2. Choose File | Open | Project.

  3. Browse to the sample project:

    For C#, browse to <install dir>\Samples\CSharp\Simple and open Simple.csproj.

    For Visual Basic .NET, browse to <install dir>\Samples\VB.NET\Simple and open Simple.vbproj.

  4. If you have installed ASE ADO.NET Data Provider using the installation program, go directly to step 7.

  5. If you have not used the installation program, then you need to correct references to the ASE ADO.NET Data Provider in the project. To do this, delete the existing reference first:

    1. In the Solution Explorer window, verify that the Simple project is expanded.

    2. Expand the References folder.

    3. Right-click Sybase.AseClient.Data.dll and select Remove.

  6. Add a reference to ASE ADO.NET Data Provider Assembly.

    For instructions, see “Adding a reference to the Data Provider assembly”.

  7. To run the Simple sample, choose Debug | Start Without Debugging, or press Ctrl+F5.

    The AseSample dialog box appears.

  8. In the AseSample dialog box, provide connection information for an Adaptive Server with the sample pubs2 database and then click Connect.

    The application connects to the sample pubs2 database and puts the last name of each author in the dialog box.

  9. Click X in the upper right corner of the window to terminate the application and disconnect from the pubs2 database.

You have now run the application. The next section describes the application code.

StepsRunning the Simple sample project without Visual Studio

  1. From a DOS prompt, go to the appropriate sample directory under <install dir>\Samples.

  2. Add the directory with .NET Framework 1.1 binaries to your system path.

  3. Verify that the dll directory under ASE ADO.NET Data Provider installation directory (the default value is C:\Sybase\ADO.NET\DLL) is included in the system path and the LIB environment variable.

  4. Compile the sample program using the supplied build script called build.bat.

  5. To run the program, enter:

    simple.exe
    

    The AseSample dialog box appears.

  6. In the AseSample dialog box, provide connection information for an Adaptive Server with the sample pubs2 database and then click Connect.

    The application connects to the sample pubs2 database and puts the last name of each author in the dialog box.

  7. Click the X in the upper right corner of the window to terminate the application and disconnect from the pubs2 database.