I am trying to connect my C# program to InterBase but i get the following error:
Borland.Data.TDBXError occurred HResult=0x80131500 Message=Unable to load dbxint.dll (ErrorCode 193). It may be missing from the system path. Source=Borland.Data.DbxCommonDriver
I've tried so many methods but none of them have worked so far. Of them all, this one looks more promising. I installed the ADO_NET 2_0 Driver for InterBase and when i try to connect to the database I get this error:
HResult=0x80131500
Message=Unable to load dbxint.dll (ErrorCode 193). It may be missing from the system path.
Source=Borland.Data.DbxCommonDriver
StackTrace:
at Borland.Data.TDBXContext.Error(Int32 ErrorCode, String ErrorMessage)
at Borland.Data.TDBXDynalinkDriverCommonLoader.LoadDriverLibrary(TDBXProperties DriverProperties, TDBXContext DBXContext)
at Borland.Data.TDBXDynalinkDriverCommonLoader.LoadDriverLibraryAndMethodTable(TDBXContext DBXContext, TDBXProperties Properties)
at Borland.Data.TDBXDynalinkDriverCommonLoader.Load(TDBXDriverDef DriverDef)
at Borland.Data.TDBXDriverRegistry.LoadDriver(TDBXDriverDef DriverDef, TList List)
at Borland.Data.TDBXDriverRegistry.GetDriver(TDBXDriverDef DriverDef)
at Borland.Data.TDBXConnectionFactory.GetDriver(String DriverName, TDBXProperties DriverProperties)
at Borland.Data.TDBXConnectionBuilder.CreateConnection()
at Borland.Data.TDBXConnectionFactory.GetConnection(TDBXContext DBXContext, TDBXProperties ConnectionProperties)
at Borland.Data.TAdoDbxConnection.Open()
at IB2._0.Form1.ReadData(DbConnection conn) in D:\C#\IB2.0\IB2.0\Form1.cs:line 36
at IB2._0.Form1..ctor() in D:\C#\IB2.0\IB2.0\Form1.cs:line 18
at IB2._0.Program.Main() in D:\C#\IB2.0\IB2.0\Program.cs:line 14
I don't know if I'm looking for this file in the wrong directory, but this file is there in my project's bin folder.
My code is shown below, may you kindly assist.
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.Vcl;
using Borland.Data.Units;
using System.Data.SqlClient;
using System.Data.Common;
namespace IB2._0 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
ReadData(getConnection());
}
public DbConnection getConnection() {
// DbProviderFactory factory = DbProviderFactories.GetFactory
// ("Borland.Data.AdoDbxClient");
DbConnection c = new TAdoDbxConnection();
//DbConnection c = factory.CreateConnection();
c.ConnectionString = "DriverName=Interbase;Database=C:\\Database\\TEST.GDB;RoleName=RoleName;User_Name=sysdba;Password=masterkey;SQLDialect=3;MetaDataAssemblyLoader=Borland.Data.TDBXInterbaseMetaDataCommandFactory,Borland.Data.DbxReadOnlyMetaData,Version=11.0.5000.0,Culture=neutral,PublicKeyToken=91d62ebb5b0d1b1b;GetDriverFunc=getSQLDriverINTERBASE;LibraryName=Dbxint30.dll;VendorLib=GDS32.DLL";
//GDS32.DLL
//fbclient.dll
return c;
}
public void ReadData(DbConnection conn) {
string sql = "select * from user";
DbCommand cmd = conn.CreateCommand();
cmd.CommandText = sql;
conn.Open();
DbDataReader myreader = cmd.ExecuteReader();
dataGridView1.DataSource = myreader;
DataSet ds = new DataSet();
DataTable dt = new DataTable("user");
ds.Tables.Add(dt);
ds.Load(myreader, LoadOption.PreserveChanges, ds.Tables[0]);
dataGridView1.DataSource = ds.Tables[0];
myreader.Close();
}
private void Form1_Load(object sender, EventArgs e) {
}
}
}
User contributions licensed under CC BY-SA 3.0