I.T. Discussion Community!
-Collapse +Expand
C#
Search C# Group:

Advanced
-Collapse +Expand C# To/From
To/FromCODEGuides
-Collapse +Expand C# Study Test
PRESTWOODCERTIFIED
-Collapse +Expand C# Store
PRESTWOODSTORE

Prestwood eMagazine

March Edition
Subscribe now! It's Free!
Enter your email:

   ► MB LobbyC# (Visual C# & VS.Net) BoardVS.Net General & Other Topic   Print This     

Trying to read Paradox 7 table in c#

Trying to read Paradox 7 table in c# in VS.Net General & Other topic (part of our C# (Visual C# & VS.Net) group).

Quick Search: Paradox   Trying read   Trying read Paradox   7 table  
Shawn.R
FL USA
Rank: Ensign

I'm trying to figure out how to read tables using c#. I've created a basic console app in Visual Studio and I'm attempting to put together a connection string to connect to c:\test\test.db and I keep getting the following error:

An unhandled exception of type 'System.Data.Odbc.OdbcException' occured in System.Data.dll

Additional information: ERROR [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified.

I assume I just have my connection string strutured improperly and I'm trying to figure out how it should be. From what I've read, the Intersolv driver is best suited for what I am trying to do, and I do see it in BDE =>Configuration=>Drivers=>ODBC (Intersolv 3.11 32-BIT as well as Intersolv 3.00 32-BIT are listed).

I'm running Paradox version 10 with Windows 7 Pro 64-bit. I found the following connection string example here:

https://www.connectionstrings.com/intersolv-3-11-odbc/

Here is the connection string I am attempting to use:

<add name="ParadoxConnection" connectionString="DSN=c:\test;AUT=1;CT=7;DQ=0;FOC=0;IS=1;USF=1;ULQ=1;" />

Here is code I'm trying to use to connect to c:\test 

        static void Main(string[] args)

        {

            Console.WriteLine(ConfigurationManager.ConnectionStrings["ParadoxConnection"].ConnectionString);

            Console.ReadLine();

            

            DataTable tbl = new DataTable();

            using (OdbcConnection conn = new OdbcConnection(ConfigurationManager.ConnectionStrings["ParadoxConnection"].ConnectionString))

            {

                conn.Open();

 

                using (OdbcCommand cmd = new OdbcCommand("SELECT * FROM test"))

                {

                    cmd.Connection = conn; 

                    OdbcDataReader reader = cmd.ExecuteReader(); 

                    tbl.Load(reader);

                }

                conn.Close();

            }

        } 

 

Thanks for your input!

~Shawn

 Posted 52 months ago (Thread Starter)
Comment Quote
About Shawn.R -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #15183, 3 reply
Thread Started 11/6/2014 7:35:10 AM
View Counter=5563
Location=FL USA 
Joined=12 years ago   MB Posts=23  
Shawn.R
FL USA
Rank: Ensign

Found this post and was able to make it work!

https://social.msdn.microsoft.com/Forums/sqlserver/en-US/9aed6c52-bb97-4c14-be73-a1eacb2df5fc/microsoft-paradox-driver-odbc

  • For a 64-bit version of Windows, the ODBC Administrator tool Odbcad32.exe (in Control Panel\Administrative Tools) is 64-bit. To create a 32-bit DSN, we need to use the 32-bit Odbcad32.exe. Please navigate to the %systemdrive%\Windows\SysWoW64 folder, execute the 32-bit Odbcad32.exe to see if Microsoft Paradox Driver is in the list.

    Reference: http://support.microsoft.com/kb/942976

 Posted 52 months ago (Thread Starter)
Comment Quote
About Shawn.R -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #15184 (Level 1.1)  Reply to 15183
Thread Started 11/6/2014 8:18:11 AM
Location=FL USA 
Joined=12 years ago   MB Posts=23  
Wes Peterson
Prestwood IT
Prestwood IT office in Citrus Heights, CA
Rank: Admiral

Hi Shawn,

I was reading your original post and getting ready to write a reply when news of your success arrived.

From my experience, the Intersolv driver works better than the Microsoft Paradox drivers.  I've tried the latter and had nothing but problems whereas it was smooth sailing with the Intersolv driver.

In Visula Studio .NET, you can use the Intersolv driver but you need to get at it via 32-bit ODBC. In other words, create a DSN that uses the Intersolv driver, then, in C#, connect to that DSN via ODBC.  Be sure that, when creating the DSN, you test the connection. If it doesn't work in the ODBC setup, it won't work anywhere.

If you're open to trying a different tool and would like to connect to the BDE directly, I suggest Delphi, but not the latest version because Embarcadero, now the owner of Delphi, has dropped support for the BDE. However, if you license Delphi (Professional or higher) you'll have the right to download earlier versions and I suggest Delphi 7 for BDE work.

The back-story is this:  When Paradox belonged to Borland, Borland created Delphi (1995), a general purpose development tool for Windows desktop programs.  From the very start, Delphi had strong database support, including Paradox. As newer versions of Delphi appeared, it gained support for more and more databases, to the point of being a nearly promiscuous tool. By the time that Delphi 7 shipped (2002), there weren't many unsupported databases.

Delphi users wrote many an application that used Paradox data tables. Paradox, itself, wasn't necessary.  Such Delphi programs could be deployed by delivering only the executable compiled by Delphi and the files that comprise the BDE (ideally in a setup program that installed the BDE if absent on the target machine).

A huge distinction between Delphj and Visual Studio is that Delphi programs can work much more directly with Paradox data.  No ODBC or DNS is required.

Because Delphi compiles its programs to highly optimized machine code, whereas .NET relies on runtime "just in time" compilers, don't be surprised if a Delphi program runs circles around an equivalent .NET program. (I hear, though, that .NET will eventually provide for machine code compilation.)

If you can't do all that you need to in C#, be comforted in knowing that there's a tool that will succeed. 

Wes Peterson
Senior Software Engineer
Prestwood IT Solutions
http://www.prestwood.com

 Posted 52 months ago
Comment Quote
About Wes Peterson -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.
About Wes Peterson

Wes Peterson is a Senior Programmer Analyst with Prestwood IT Solutions where he develops custom Windows software and custom websites using .Net and Delphi. When Wes is not coding for clients, he participates in this online community. Prior to his 10-year love-affair with Delphi, he worked with several other tools and databases. Currently he specializes in VS.Net using C# and VB.Net. To Wes, the .NET revolution is as exciting as the birth of Delphi.


Post ID #15185 (Level 2) and Parent is 15183
Reply Posted 11/6/2014 8:20:20 AM
Location=Prestwood IT office in Citrus Heights, CA 
Joined=15 years ago   MB Posts=158   KB Posts=163   KB Comments=34   BLOG, Topics=20  
Most Recent Post
Shawn.R
FL USA
Rank: Ensign

Great info Wes! Thanks for the detailed response :)

-Shawn

 Posted 52 months ago (Thread Starter)
Comment Quote
About Shawn.R -Collapse +Expand
Visit Profile
Approved member.
Member subscribes to this thread with a verified email.

Post ID #15186 (Level 1.1)  Reply to 15185 and Parent is 15183
Thread Started 11/6/2014 12:27:09 PM
Location=FL USA 
Joined=12 years ago   MB Posts=23  

Revive Thread!

Add a comment to revive this old thread and make this archived thread more useful.

Write a Comment...
Full Editor
...
Sign in...

If you are a member, Sign In. Or, you can Create a Free account now.


Anonymous Post (text-only, no HTML):

Enter your name and security key.

Your Name:
Security key = P1226A1
Enter key:
Icon: A Post    Thread    Idea    Important!    Cool    Sad    No    Yes    Includes a Link...   
Thread #15183 Counter
5563
Since 11/6/2014
-
   Contact Us!
 
PrestwoodBoards.com was developed and is maintainted by me. Do you have a question or suggestion? Do you see a problem? Contact me now. My goal is to build an ad-free and spam-free source of I.T. information with many contributers (ok to promote your website/company in your bio). Yes, my company Prestwood IT Solutions is mentioned in my bio which shows with every post, but you can contribute and promote your pet project too!

2,318 People Online Now!!  
Sign In to see who's online now!  Not a member? Join now. It's free!
Show more stats...


©1995-2019 PrestwoodBoards  [Security & Privacy]
Professional IT Services: Coding | Websites | Computer Tech