Purchase |  Products |  Downloads |  Forums |  Blog |  Free Trial     

2.1 is no longer sold or supported - these pages are for reference purposes only. VistaDB 3.x should be used for all new development.

VistaDB 2.1 Your First Application

This Getting Started shows how to quickly create a simple application that uses VistaDB. If you are new to VistaDB, please see the Getting Started section first in order to gain a broader understanding of what VistaDB can do for you.

Developing database applications that use VistaDB is very intuitive and easy. VistaDB provides native components that integrate tightly into popular development IDE's and that are fully compatible with Microsoft's .NET 1.1/ 2.0 frameworks, and with Borland's VCL framework.

Using Visual Studio .NET 2003

Installing VistaDB into Visual Studio .NET 2003

  1. Run Visual Studio .NET 2003 (or Visual Studio 2005)
  2. Create a new project or new form solution or use the one made by the Editor Wizard
  3. Select View Designer mode to see the application form in the editor
  4. Select the Toolbox icon and select the Data tab on the Toolbox
  5. Right-click and select "Add/Remove Items..."
  6. In the Customize Toolbox dialog, press the Browse button and select one of the following:
    for Visual Studio 2003 (.NET 1.1):
      C:\Program Files\VistaDB 2.1\NET 1.1\Provider\VistaDB.Provider.DLL

    for Visual Studio 2005 (.NET 2.0):
      C:\Program Files\VistaDB 2.1\NET 2.0\Provider\VistaDB.Provider.DLL
  7. Click ok on the hilited items VistaDBCommand, VistaDBConnection, VistaDBDataAdapter, VistaDBDatabase, VistaDBDataSet
  8. VS.NET will hilite and install the VistaDB components into the Toolbox dialog

Creating your first .NET application

  1. Run Visual Studio .NET 2003 (or Visual Studio 2005)
  2. Create a new Visual Studio C# or VB.NET WinForms application
  3. Drop VistaDBDataAdapter onto the form. This will display the VistaDB wizard.
  4. Click the Browse button and select the database "ADOSample.vdb" and click OK.
  5. Click Continue and enter the following SQL statement:
      SELECT * FROM customer
  6. Check "[x] Create UPDATE, INSERT and DELETE command automatically" to create update, insert and delete command objects automatically
  7. Check "[x] Auto-create DataSet" to automatically create the DataSet for the SQL query
  8. Drop a DataGrid control on the form and set its DataSource property to:
    vistaDBDataSet1.customer
  9. Drop a Button on the form and name it "Fill". Double click on the button and enter the following code to fill the dataset with data from from database:
      vistaDBDataSet1.Clear();
      vistaDBDataAdapter1.Fill(vistaDBDataSet1, "customer");
  10. Drop a 2nd Button on the form and name it "Update". Double click on the button and enter the following code to update the database from data set:
      vistaDBDataAdapter1.Update(vistaDBDataSet1, "customer");

Using Delphi 7 (Applies to 5,6,7 and 2005)

Installing VistaDB into Visual Studio .NET 2003

  1. Run the Borland IDE (e.g. Delphi 7 or Delphi 2005 etc.)
  2. File | Open and browse to the corresponding Borland IDE sub-directory under
    C:\Program Files\VistaDB 2.1\VCL\[Borland IDE]
    where [Borland IDE] can be one of the following:
    D5=Delphi 5, D6=Delphi 6, D7=Delphi 7, D2005=Delphi 2005, CB5= C++Builder 5 and CB6=C++Builder 6
  3. Open the two package files (e.g. VistaDB_D7.dpk and VistaDB_D7d.dpk) The extra "d" in the name is the design-time package.
  4. Compile the package without the "d" (e.g. VistaDB_D7.dpk)
  5. Compile the package with the "d" (e.g. VistaDB_D7d.dpk) and install this one.
  6. The Borland IDE will now have installed the VistaDB components in the Toolbar Palette under the "VistaDB" tab

Creating your first VCL application

  1. Run Delphi 7 (or any of the Borland IDEs listed above)
  2. Create a new Application
  3. Click on the VistaDB tab
  4. Drop a VDBDatabase component onto your form and press F11 (Object Inspector)
    • Directory = C:\Program Files\VistaDB 2.1\Data
    • DatabaseName = test.vdb
    • Connected = True
  5. Drop a VDBTable component onto your form and press F11
    • Database = VDBDatabase1
    • TableName = Test
    • Active = True
  6. Drop a DataSource component onto your form and press F11
    • DataSet =VDBTable1
  7. Drop a DBGrid component onto your form and press F11
    • DataSource =DataSource1
  8. Drop a DBNavigator component onto your form and press F11
    • DataSource =DataSource1
  9. Run.

Using Visual Basic 6

  1. Run Visual Basic 6
  2. File | New Project | Standard EXE
  3. Drop a button on the form and double click on it
  4. Copy this code into your editor:

    Set vdb = CreateObject("VistaDBCOM20.Database")
    Set vQuery = CreateObject("VistaDBCOM20.Query")
    vdb.DatabaseName = "C:\Program Files\VistaDB 2.1\Data\Test.VDB" vdb.Exclusive = True
    vdb.open
    vQuery.SQL = "SELECT * FROM Customer"
    vQuery.open
    While Not vQuery.EOF
       first = Trim(vQuery.GetString("First"))
       last = Trim(vQuery.GetString("Last"))
       age = vQuery.GetInt32("Age")
       hiredate = vQuery.GetDate("HireDate")
       vQuery.Next
    Wend
    vQuery.Close
    vdb.Close
    Set vQuery = Nothing
    Set vdb = Nothing

  5. Run and press the button.

Using VBScript with classic ASP 3

Installing VistaDB COM on your IIS web server

  1. FTP VistaDBCOM20.DLL and VistaDB20.DLL to your web server.
    1. If you plan on building multiple ASP web applications that use VistaDB, then FTP these files to a main directory on your web server (e.g. C:\Program Files\VistaDB 2.1\COM or C:\VistaDB21\Bin)
    2. If you plan to use VistaDB for one web site only, then FTP these 2 files to your web site's ..\Bin directory
  2. After the 2 VistaDB files are on your web server, you will need to run:
    RegSvr32 VistaDB20COM.DLL /install
    Note: VistaDB20..DLL does not require registration.
  3. The VistaDB COM objects (Database, Table, Query, EMail) are now available for use by any application on the web server

Directories and Permissions

  1. For this sample, we assume you have this directory structure:
    C:\inetpub\wwwroot\MySite
    C:\inetpub\wwwroot\MySite\Bin    [optional]
    C:\inetpub\wwwroot\MySite\Data
  2. To ensure that your ASP web application will work, assign EVERYONE permissions to the ..\Data directory

Creating your first classic ASP web application

  1. Open a text editor for writing ASP VBScript
  2. Copy this code into your editor:

    <%@ Language=VBScript %>
    <% dim vdb, vQuery, lname, rowid

    Set vdb = Server.CreateObject("VistaDBCOM20.Database")
    Set vQuery = CreateObject("VistaDBCOM20.Query")

    vDB.ASPMode = true
    vdb.DatabaseName = "C:\inetpub\wwwroot\MySite\Data\Test.VDB" vdb.Exclusive = False
    vdb.open
    vQuery.SQL = "SELECT * FROM Customer"
    vQuery.open
    While (Not vQuery.EOF)
       rowid = Cstr(vQuery.RowID)
       lname = Trim(vQuery.GetString("Last"))
       Response.write( rowid + ":" + lname +"<br>")
       vQuery.Next
    Wend
    vQuery.Close
    vdb.Close
    Set vQuery = Nothing
    Set vdb = Nothing
    %>

  3. Run and press the button.
Home |  Support |  FAQ |  Testimonials |  Site Map |  Contact Us |  News Archives |  Terms  
 © 1999-2008 VistaDB Software, Inc. All rights reserved.