2

I'm trying to add values in a paradox table with c#.

The point is that this table is containing localized strings, for which the Langdriver ANSII850 is required by the BDE.

I tried to use both OLEDB and Odbc drivers in .Net, but I cannot write correct values in my database. I always get encoding issues.

Example:

// ODBC Connection string (using string.Format for setting the path)
string connectionBase = @"Driver={{Microsoft Paradox Driver (*.db )}};DriverID=538;Fil=Paradox 5.X;DefaultDir={0};CollatingSequence=ASCII;";

// I tried to put the langdriver in the CollatingSequence parameter
string connectionBase = @"Driver={{Microsoft Paradox Driver (*.db )}};DriverID=538;Fil=Paradox 5.X;DefaultDir={0};CollatingSequence=ANSII850;";

// I tried the OleDb driver
string connectionBase =  @"Provider=Microsoft.Jet.OLEDB.4.0;Extended Properties=Paradox 5.x;"Data Source={0};";

Then, I'm trying to insert the value "çã á çõ" in order to test. Depending on the driver I'm using, I get different results but the final string is never encoded correctly.

Edited:

Finally, I found a solution, but not ideal:

  • I'm able to switch from a langdriver to another by calling an external executable, written in delphi. In this case, I'm using ANSII850.
  • Then, I'm able to read data from my paradox tables. But I still don't get my data in a good format.
  • Strings from the tables are not encoded with the code page 850 either, trying to decode them with .Net tools just does not work
  • Instead, I'm manually tracking special chars (that are not correctly read) and replacing them by the correct utf8 chars.
  • For writing I'm doing the exact opposite.

It works, but it's still not ideal.

ghusse
  • 3,200
  • 2
  • 22
  • 30

1 Answers1

0

Are you sure you're using the BDE? Your examples refer to a lot of Microsoft parts.

The BDE used the higher codes for these "special characters" and a codepage to interpret them. Looks like 850 is what you think would be correct. If you can just send a string to the bde with the hex or decimal of the characters you want, you may be able to see if it will print that correctly.

Patrick Moloney
  • 642
  • 5
  • 14
  • I'm trying to access those tables in C#.Net, how can I use the BDE? Is there another way (I'd rather not use the BDE) – ghusse Mar 01 '12 at 15:13
  • Maybe I misunderstood, but your question asked about the BDE. Using .Net I think you would have to see what Microsoft uses. Their software has also been able to read Paradox tables. I don't know how .Net reads the old codepages, but before .Net MS software also used and could specify code pages. – Patrick Moloney Mar 02 '12 at 23:50
  • Thanks for your comment, you gave me a lead – ghusse Mar 05 '12 at 10:55