Solved

BDE Langdriver setting at runtime

Posted on 1998-11-29
3
2,326 Views
Last Modified: 2013-11-23
I have some problems with the BDE 'langdriver' parameter.

I have to use german character codes with different ODBC drivers (COBOL ISAM, ORACLE, MS_SQL,..). On some systems I get correct characters, on others I don't. I found that the problem is, that as default there is no entry in the 'lngdriver' parameter of driver in the BDE (V4.51). Once I set this to 'WEUROPE (ANSI)' via BDE-Admin everything works nicely.

My question is: How can I set the 'langdriver' parameter at runtime? I tried TDataSet.Params but this did not work.

Thank you! Roadrunner
0
Comment
Question by:Roadrunner100598
  • 2
3 Comments
 
LVL 5

Accepted Solution

by:
ronit051397 earned 50 total points
ID: 1348555
To change the LANGDRIVER to WEUROPE (ANSI) in a Paradox Table, write:

 SetConfigParameter('\DRIVERS\PARADOX\INIT\;LANGDRIVER','WEUROPE (ANSI)');

uses BDE, DBTables, DB;

    procedure SetConfigParameter(Param: string; Value: string);
    var
      hCur: hDBICur;
      rslt: DBIResult;
      Config: CFGDesc;
      Path, Option: string;
      Found: boolean;
      Temp: array[0..255] of char;
    begin
      hCur := nil;
      Found := False;
      try
      Check(dbiInit(Nil));
        if Pos(';', Param) = 0 then
          raise EDatabaseError.Create('Invalid parameter passed to function.  There must ' +
            'be a semi-colon delimited sting passed');
        Path := Copy(Param, 0, Pos(';', Param) - 1);
        Option := Copy(Param, Pos(';', Param) + 1, Length(Param) - Pos(';', Param));
        Check(DbiOpenCfgInfoList(nil, dbiREADWRITE, cfgPERSISTENT, StrPCopy(Temp, Path), hCur));
        repeat
          rslt := DbiGetNextRecord(hCur, dbiNOLOCK, @Config, nil);
          if rslt = DBIERR_NONE then
          begin
            if StrPas(Config.szNodeName) = Option then
            begin
              StrPCopy(Config.szValue, Value);
              Check(DbiModifyRecord(hCur, @Config, FALSE));
              Found := True;
              break;
            end;
          end
          else
          if rslt <> DBIERR_EOF then Check(rslt);
        until rslt <> DBIERR_NONE;
        if Found = False then
          raise EDatabaseError.Create(Param + ' entry was not found in configuration file');
      finally
        if hCur <> nil then Check(DbiCloseCursor(hCur));
        DbiExit;
      end;
    end;
0
 
LVL 1

Author Comment

by:Roadrunner100598
ID: 1348556
Thank you Ronit for the excellent answere!

I had to work out two minor problems myself - so just for the record:

For ODBC drivers the LangDriver Parameter is in the path
\DRIVERS\Name of ODBC Driver\DB OPEN\

If the ODBC driver name contains spaces, a backslash has to end the path - otherwise the last backslash is added automatically.
0
 
LVL 5

Expert Comment

by:ronit051397
ID: 1348557
Thanks for the info.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
delphi prevent click fast 2 191
Delphi application Soap connection 5 96
Tviruailstringtree sort multi columns on header click 1 54
SUM 2 INTEGER ARRAYS INTO 1 10 93
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

867 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now