Articles   Members Online:
-Article/Tip Search
-News Group Search over 21 Million news group articles.
-Delphi/Pascal
-CBuilder/C++
-C#Builder/C#
-JBuilder/Java
-Kylix
Member Area
-Home
-Account Center
-Top 10 NEW!!
-Submit Article/Tip
-Forums Upgraded!!
-My Articles
-Edit Information
-Login/Logout
-Become a Member
-Why sign up!
-Newsletter
-Chat Online!
-Indexes NEW!!
Employment
-Build your resume
-Find a job
-Post a job
-Resume Search
Contacts
-Contacts
-Feedbacks
-Link to us
-Privacy/Disclaimer
Embarcadero
Visit Embarcadero
Embarcadero Community
JEDI
Links
How to change the Paradox table language driver at runtime Turn on/off line numbers in source code. Switch to Orginial background IDE or DSP color Comment or reply to this aritlce/tip for discussion. Bookmark this article to my favorite article(s). Print this article
18-Oct-02
Category
Database Others
Language
Delphi 2.x
Views
110
User Rating
No Votes
# Votes
0
Replies
0
Publisher:
DSP, Administrator
Reference URL:
DKB
			Author: Jonas Bilinkevicius

How can I change the language driver of a Paradox table at runtime?

Answer:

The following code should to that:

1   procedure SetLanguage(Tbl: TTable; Lang: DbiName);
2   var
3     pOptDesc: pFLDDesc;
4     pOptData: pBYTE;
5     hDb: hDbiDb;
6     TblDesc: CRTblDesc;
7     Dir: string;
8   begin
9     pOptDesc := AllocMem(sizeof(FLDDesc));
10    pOptData := AllocMem(20);
11    SetLength(Dir, dbiMaxNameLen + 1);
12    Tbl.Active := True;
13    Check(DbiGetDirectory(Tbl.DBHandle, False, PChar(Dir)));
14    SetLength(Dir, StrLen(PChar(Dir)));
15    try
16      FillChar(TblDesc, sizeof(CRTblDesc), #0);
17      Tbl.DisableControls;
18      Tbl.Close;
19      Check(DbiOpenDatabase(nil, nil, dbiReadWrite, dbiOpenExcl, nil, 0, nil, nil,
20        hDb));
21      Check(DbiSetDirectory(hDb, PChar(Dir)));
22      pOptDesc.iOffset := 0;
23      pOptDesc.iLen := Length(Lang) + 1;
24      StrPCopy(pOptDesc.szName, 'LANGDRIVER');
25      StrPCopy(PChar(pOptData), Lang);
26      TblDesc.iOptParams := 1;
27      TblDesc.pfldOptParams := pOptDesc;
28      TblDesc.pOptData := pOptData;
29      StrPCopy(TblDesc.szTblName, Tbl.TableName);
30      StrCopy(TblDesc.szTblType, szParadox);
31      Check(DbiDoRestructure(hDb, 1, @TblDesc, nil, nil, nil, False));
32    finally
33      Check(DbiCloseDatabase(hDb));
34      FreeMem(pOptDesc, sizeof(FLDDesc));
35      FreeMem(pOptData, 20);
36      Tbl.EnableControls;
37    end;
38  end;


			
Vote: How useful do you find this Article/Tip?
Bad Excellent
1 2 3 4 5 6 7 8 9 10

 

Advertisement
Share this page
Advertisement
Download from Google

Copyright © Mendozi Enterprises LLC