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
- Run Visual Studio .NET 2003 (or Visual Studio 2005)
- Create a new project or new form solution or use the one made
by the Editor Wizard
- Select View Designer mode to see the application form in the
editor
- Select the Toolbox icon and select the Data tab on the
Toolbox
- Right-click and select "Add/Remove Items..."
- 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
- Click ok on the hilited items VistaDBCommand,
VistaDBConnection, VistaDBDataAdapter, VistaDBDatabase, VistaDBDataSet
- VS.NET will hilite and install the VistaDB components into
the Toolbox dialog
Creating your first .NET application
- Run Visual Studio .NET 2003 (or Visual Studio 2005)
- Create a new Visual Studio C# or VB.NET WinForms application
- Drop VistaDBDataAdapter onto the form. This will display the
VistaDB wizard.
- Click the Browse button and select the database
"ADOSample.vdb" and click OK.
- Click Continue and enter the following SQL statement:
SELECT * FROM customer
- Check "[x] Create UPDATE, INSERT and DELETE command
automatically" to create update, insert and delete command objects
automatically
- Check "[x] Auto-create DataSet" to automatically create the
DataSet for the SQL query
- Drop a DataGrid control on the form and set its DataSource
property to:
vistaDBDataSet1.customer
- 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");
- 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
- Run the Borland IDE (e.g. Delphi 7 or Delphi 2005 etc.)
- 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
- 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.
- Compile the package without the "d" (e.g. VistaDB_D7.dpk)
- Compile the package with the "d" (e.g. VistaDB_D7d.dpk) and
install this one.
- The Borland IDE will now have installed the VistaDB
components in the Toolbar Palette under the "VistaDB" tab
Creating your first VCL application
- Run Delphi 7 (or any of the Borland IDEs listed above)
- Create a new Application
- Click on the VistaDB tab
- 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
- Drop a VDBTable component onto your form and press F11
- Database = VDBDatabase1
- TableName = Test
- Active = True
- Drop a DataSource component onto your form and press F11
- Drop a DBGrid component onto your form and press F11
- Drop a DBNavigator component onto your form and press F11
- Run.
Using Visual Basic 6
- Run Visual Basic 6
- File | New Project | Standard EXE
- Drop a button on the form and double click on it
- 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
- Run and press the button.
Using VBScript with classic ASP 3
Installing VistaDB COM on your IIS web server
- FTP VistaDBCOM20.DLL and VistaDB20.DLL to your web server.
- 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)
- If you plan to use VistaDB for one web site only, then
FTP these 2 files to your web site's ..\Bin directory
- 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.
- The VistaDB COM objects (Database, Table, Query, EMail) are
now available for use by any application on the web server
Directories and Permissions
- 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
- To ensure that your ASP web application will work, assign
EVERYONE permissions to the ..\Data directory
Creating your first classic ASP web application
- Open a text editor for writing ASP VBScript
- 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 %>
- Run and press the button.
|