Sample Code
|
-
Truly embedded ADO.NET 2 SQL database for .NET 2+, CF 2 and Mono
-
Less than 1 MB single assembly deployment
-
Cross-platform Windows, Linux and Mac OS X support using the Mono Project
-
Easy migration from SQL Server TSQL
Royalty-free distribution
|
 |
 |
ADO.NET Data
Provider
The built-in VistaDB.ADO.NET Provider is fully compatible with
ADO.NET 2.0. It provides full support for disconnected SQL-based
data management, exactly like the SqlClient Provider. The VistaDB ADO.NET
Provider components include VistaDBConnection, VistaDBDataAdapter,
VistaDBDataReader, VistaDBCommand and each work with databound controls and 3rd
party products that support ADO.NET managed provider factories.
C# sample using the VistaDB ADO.NET Data Provider
VistaDBConnection conn = new
VistaDBConnection(); conn.ConnectionString = "Data Source =
C:\\MyData\\MyDB.vdb";
VistaDBDataAdapter adapterPerson = new
VistaDBDataAdapter(); DataSet dsPerson = new
DataSet(); adapterPerson.SelectCommand = new VistaDBCommand("SELECT * FROM
Person", conn);
dsPerson.Clear(); adapterPerson.Fill(dsPerson,"Person"); gridPerson.Data
Source = dsPerson; gridPerson.DataMember = "Person";
Direct Data Access Objects (DDA)
Direct Data Access objects or DDA is unique to VistaDB.
DDA consists of 3 .NET objects: VistaDBDatabase, VistaDBTable and the
VistaDBDataSet that give you total control over a .VDB3 database. These classes
provide an intuitive, yet powerful object-oriented method of managing data,
sometimes referred to as "live cursors", "scrollable cursors" or "navigational
control". DDA lets you navigate dynamically through data tables without having
to load the entire table or dataset into memory. DDA provides more performance
over ADO.NET's disconnected data model. See
screenshots. The VistaDBDataSet allows DDA to be fully comaptible with all
databound controls.
C# sample using the VistaDB DDA objects
// Use the VistaDB Direct Data Access objects
IVistaDBDDA DDAObj = VistaDBEngine.Connections.OpenDDA();
// Create a connection object to a VistaDB database
IVistaDBDatabase vDB = DDAObj.OpenDatabase("C:\\MyData\\MyDB.vdb", VistaDBDatabaseOpenMode.ExclusiveReadWrite, null);
// Open the table
IVistaDBTable vTable = vDB.OpenTable("Person", false, false);
// Define local vars to hold the data
string fname;
string lname;
bool married;
int age;
// Traverse the table to get the records
while( !vTable.EndOfTable )
{
fname = Convert.ToString( vTable.Get("FirstName") );
lname = Convert.ToString(vTable.Get("LastName"));
married = Convert.ToBoolean( vTable.Get( "Married"));
age = Convert.ToInt32( vTable.Get( "Age") );
Console.WriteLine( "{0} {1} {2} {3}", fname, lname, married, age);
// move to the next record
vTable.Next();
} // Close our connections
vTable.Close();
vTable.Dispose();
vTable = null;
vDB.Close();
Samples Included
Over 30 sample applications are included with the free trial showing how to use both DDA and ADO.NET objects. Most examples are provided in C# and VB.Net.
Top of page
|