Note: If you have previously installed Embarcadero RAD
Studio XE2 on this computer, you do not need to perform any additional
installation procedures in order to use the ADO.NET 2.0 driver with Microsoft
Visual Studio 2005/2008.
Prerequisites:
.NET 2.0 SDK with update
Microsoft Visual Studio 2005/2008
Embarcadero InterBase
Installation Instructions:
Run the InterBase ADO.NET 2.0 installer.
Usage instructions:
Start Visual Studio 2005/2008.
File new C# windows application.
Project- Add Reference and add the AdoDbxClient.dll, DbxCommonDriver,
DBXInterBaseDriver to your
project.
Add a DataGridView component to your Windows Form
The sample code below, fills a DataGridview component with the contents of the employee table of the employee.gdb sample InterBase database.
>>>
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Borland.Data;
using Borland.Data.Units;
using System.Data.SqlClient;
using System.Data.Common;
namespace IBXEApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
ReadData(getConnection());
}
public DbConnection getConnection()
{
// DbProviderFactory factory = DbProviderFactories.GetFactory
// ("Borland.Data.AdoDbxClient");
DbConnection c = new TAdoDbxInterBaseConnection();
//DbConnection c = factory.CreateConnection();
c.ConnectionString =
"Database=C:\\Embarcadero\\InterBase\\examples\\database\\employee.gdb;User_Name=sysdba;Password=masterkey";
return c;
}
public void ReadData(DbConnection conn)
{
string sql = "select * from employee";
DbCommand cmd = conn.CreateCommand();
cmd.CommandText = sql;
conn.Open();
DbDataReader myreader = cmd.ExecuteReader();
dataGridView1.DataSource = myreader;
DataSet ds = new DataSet();
DataTable dt = new DataTable("employee");
ds.Tables.Add(dt);
ds.Load(myreader, LoadOption.PreserveChanges, ds.Tables[0]);
dataGridView1.DataSource = ds.Tables[0];
myreader.Close();
}
private void dataGridView1_CellContentClick(object
sender, DataGridViewCellEventArgs e)
{
}
}
}
<<<
Copyright© 2010-2012 Embarcadero Technologies Inc. All rights reserved. All
Embarcadero and CodeGear brand and product names are
service marks, trademarks or registered trademarks of Embarcadero Technologies
Inc. in the United States and
other countries. All other marks are the property of their respective owners.