Accessing Data using DBISAM ODBC Driver with C#.NET

Hello again,

My work is always an adventure, and it’s fun too. I’m currently working with a project where I need to connect to a DBISAM Tables (dat files) to get some data so I thought is a good idea to create a post about it.

The first thing you need to do is to download the DBISAM Drivers (in case you don’t have it installed), I downloaded from here (you need to register first!)

I downloaded the file DBISAM-ODBC-TRIAL – DBISAM ODBC Trial

After the installation we need to configure our data source, for this we will use the ODBC Data Source Administrator we have in Windows, just go to Administrative Tools and open the ODBC (Data Sources) program.

NOTES (In case you have Windows 7 64-bit)
Because I have the Windows 7 Pro 64-bit version I need to use the 32-bit ODBC Data Source Administrator Tool because the drivers are in 32-bits for more information please check this article.

So we are ready to use this data source in our program. First we need to import the libraries we will use.

using System;
using System.Data.Odbc;

As you can see I imported the ODBC library from System.Data Assembly to use this class to connect to our data source. The next step is to create the OdbcCommand that have the SQL query we want to use.

string queryString = "SELECT * FROM machine";
OdbcCommand command = new OdbcCommand(queryString);

Then if we want to access to the data within the data source we need to create a connection, right?

string connectionStg = "PROVIDER=MSDASQL;DSN=MacDB;UID=admin;PWD=;";
OdbcConnection connection = new OdbcConnection(connectionStg)

Now we have a connection using a connection string we created (please note that the DSN is the name we created for the data source in the ODBC Data Source).

The final step is to execute our query and display the results:

using (OdbcConnection connection = new OdbcConnection(connectionStg))
    command.Connection = connection;
    OdbcDataReader reader = command.ExecuteReader();

    int fCount = reader.FieldCount;
    while (reader.Read())
        for (int i = 0; i < fCount; i++)


And that’s it, working and clean!


5 thoughts on “Accessing Data using DBISAM ODBC Driver with C#.NET

  1. Thank you Alejandro for your post. Thanks to you I was able to read from a database that we thought was lost. Now there’s another issue I’m facing: I can’t afford the $250 license for the DBISAM ODBC driver. Looking on the web I found a free driver, but I can’t seem to be able to create a data source with it, it keeps asking me for a login and password, I’ve tried a few combinations but I get rejected. Here goes: (the ODBC driver). If you have any idea how to use it I’d love to see another tutorial from you. Thanks again for the help!

  2. Thanks for posting! 🙂 Just followed your instructions and Its working for me. Any idea how to work with remote dbisam databases ?

  3. Getting error : ERROR [42S02] [Elevate Software][DBISAM] DBISAM Engine Error # 11010 Table or backup file ‘agreement’ does not exist

  4. Andrew says:

    Hi, Have you tryed to filter query results by date in C# using this method?.
    I have been trying to do it, but all my querys return empty 😦

  5. soulfiremage says:

    How do you actually persuade it to access datafiles in this format?! This is totally omitted from the description anyhere so far. I’ve got a working odbc connection thanks to your article, just can’t talk to the files I need!.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: