Autor Beitrag
bockwurst
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 191

win98 /XP
D1 D5 Prof DE2005PE
BeitragVerfasst: Di 06.11.07 15:35 
Hallo zusammen,

ich suche den Befehl (zur Laufzeit) zum Anzeigen/herausfinden aller Sprachtreiber, mit BDE, für eine Paradox-Tabelle.
Schön wenn mir auch jemmand sagen könnte, wie ich zur Laufzeit den Sprachtreiber, der Tabelle (nicht der BDE-Konfig), ändern könnte.
Gibt es dann einen Befehl, der gleich die ganze Datenbank "in den richtigen Sprachtreiber" konvertiert?

danke!
raiguen
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 374

WIN 2000prof, WIN XP prof
D7EP, MSSQL, ABSDB
BeitragVerfasst: Di 06.11.07 21:55 
Moin :)
Vielleicht hilft das hier ausm EntwicklerForum
bockwurst Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 191

win98 /XP
D1 D5 Prof DE2005PE
BeitragVerfasst: Mi 07.11.07 17:24 
Titel: Hilft leider nicht!
hallo raiguen,

ich habe vorher auch schon Foren durchsucht. Dort trat mein Problem in Abwandlung auch schon auf. Ich möchte aber nicht mit einer externen Datenbank den Sprachtreiber ändern, sondern mit einem, von mir geschriebenen Prog. Auch möchte ich nicht die Konfig der BDE ändern, weil dies nur Auswirkungen auf neue Tabellen, und nicht auf schon exist., hat. Auch hatte einer eine Idee mit TDatabase. Aber leider habe ich es damit nicht geschafft, weil ich nicht wußte wie!

LG Andreas
bockwurst Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 191

win98 /XP
D1 D5 Prof DE2005PE
BeitragVerfasst: Do 08.11.07 15:23 
Hallo zusammen,

wie man die Sprachtreiber anzeigen kann, habe ich nun herausgefunden.


ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
Example 1: Return all language driver information for the system
This example uses the following input:

  GetLdList(Memo1.Lines);

The function is defined as follows: 
USES BDE;

procedure GetLdList(Lines: TStrings);

var
  hCur: hDBICur;
  LD: LDDesc;
begin
  // get a cursor to the in-mem table containing language driver information...
  Check(DbiOpenLdList(hCur));
  try
    while (DbiGetNextRecord(hCur, dbiNOLOCK, @LD, nil) = DBIERR_NONE) do begin
      // add the name, code page, and description to the result...
      Lines.Add('Name: ' + LD.szName + '  Code Page: ' + IntToStr(LD.iCodePage));
      Lines.Add('    Description: ' + LD.szDesc);

    end;
  finally
    Check(DbiCloseCursor(hCur));
  end;
end;


Fehlt jetzt nur noch, wie ich ihn mit Hilfe von DbiDoRestructure in der Tabelle setzen kann.
Kann mir einer helfen?!

Gruß Andreas
bockwurst Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 191

win98 /XP
D1 D5 Prof DE2005PE
BeitragVerfasst: Do 08.11.07 16:30 
Diese Procedure ändert in einer geschl. Tabelle den Sprachtreiber.

Ich habe in einem rus.Forum noch etwas gefunden.
Und das Beste, es funkt!


ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
46:
47:
48:
49:
50:
51:
52:
53:
54:
55:
56:
57:
58:
59:
60:
61:
62:
uses DbiTypes, DbiProcs, DbiErrs, DB, WinProcs, SysUtils;
...

// Databasename=Alias  TableName=Tabellenname+.DB   LDName=Sprachtreiber
procedure ChangeLangDriver(DatabaseName, TableName, LDName: string);
var
  TblExt: string;
  Database: TDatabase;
  TblDesc: CRTblDesc;
  OptDesc: FLDDesc;
  OptData: array[0..250of Char;
  Cur: hDBICur;
  Rec: CFGDesc;
begin
  if (TableName = ''or (LDName = ''then
    raise Exception.Create('Unknown TableName or LDName');
  Database := Session.OpenDatabase(DatabaseName);
  try
    if Database.IsSQLBased then
      raise Exception.Create(
        'Function ChangeLangDriver working only with dBase or Paradox tables');
    FillChar(OptDesc, SizeOf(OptDesc), #0);
    FillChar(TblDesc, SizeOf(TblDesc), #0);
    StrCopy(OptDesc.szName, 'LANGDRIVER');
    OptDesc.iLen := Length(LDName) + 1;
    with TblDesc do
    begin
      StrPCopy(szTblName, TableName);
      TblExt := UpperCase(ExtractFileExt(TableName));
      if TblExt = 'DBF' then
        StrCopy(szTblType, szDbase)
      else if TblExt = '.DB' then
        StrCopy(szTblType, szParadox)
      else
      begin
        AnsiToOEM(StrPCopy(OptData, DatabaseName), OptData);
        if DbiOpenCfgInfoList(nil, dbiREADONLY, cfgPersistent,
          StrPCopy(OptData, '\DATABASES\' + StrPas(OptData) + '\DB INFO\'),
          Cur) <> DBIERR_NONE then
          raise Exception.Create('Unknown table type');
        try
          while DbiGetNextRecord(Cur, dbiNOLOCK, @Rec, nil) <> DBIERR_EOF do
            if StrComp(Rec.szNodeName, 'DEFAULT DRIVER') = 0 then
            begin
              StrCopy(szTblType, Rec.szValue);
              Break;
            end;
        finally
          Check(DbiCloseCursor(Cur));
        end;
      end;
      iOptParams := 1;
      pfldOptParams := @OptDesc;
      pOptData := @OptData;
    end;
    StrPCopy(OptData, LDName);
    Check(DbiDoRestructure(Database.Handle, 1, @TblDesc, nil,
      nilnil, False));
  finally
    Session.CloseDatabase(Database);
  end;
end;