Autor Beitrag
ralph
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 57

openSUSE 10.3 mit Crossover Linux 6.2
Delphi 3 Pro, Freereport 2.32
BeitragVerfasst: Mi 02.02.05 10:11 
Hallo,

ich möchte mit Delphi 3 Pro zur Laufzeit aus einer bestehenden Datenbank (Paradox oder dBase) eine neue Datenbank gleichen Typs mit identischer Struktur erstellen. Ein Codebeispiel wäre sehr hilfreich.

Danke

Ralli
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 02.02.05 10:19 
Hallo Ralph :welcome:

Sieh dir mal die Komponente TBatchMove (Online-Hilfe) an. Dort gibt es einen Parameter, mit dem man genau das durchführen kann.
Frag mich jetzt bloß nicht wie der heißt. Ich müsste es auch erst in der OH nachlesen.
ralph Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 57

openSUSE 10.3 mit Crossover Linux 6.2
Delphi 3 Pro, Freereport 2.32
BeitragVerfasst: Mi 02.02.05 10:29 
Titel: Das habe ich schon probiert
Hallo Peter,

das habe ich schon probiert. Es funktioniert aber nur, wenn die Zieldatenbank vorhanden ist.

Hier mein Quellcode:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TForm1.Button2Click(Sender: TObject);
begin
Ziel.active := False;
batchmove1.Source := Quelle;
batchmove1.mode := batcopy;
batchmove1.destination := Ziel;
batchmove1.execute;
end;


Ich möchte aber, das eine leere, nicht vorhandene Datenbank mit identischer Struktur der Quelldatenbank erstellt wird. Sie soll zu weiteren Berabeitung benutz werden, der Name sollte frei wählbar sein.

Danke für die schnelle Hilfe.

Ralph

Moderiert von user profile iconraziel: Delphi-Tags hinzugefügt
jasocul
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 6395
Erhaltene Danke: 149

Windows 7 + Windows 10
Sydney Prof + CE
BeitragVerfasst: Mi 02.02.05 10:43 
Bei mir funktioniert das. Habs gerade getestet. Einziges Problem ist, dass die neue Tabelle auch alle Datensätze bekommt.
ralph Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 57

openSUSE 10.3 mit Crossover Linux 6.2
Delphi 3 Pro, Freereport 2.32
BeitragVerfasst: Mi 02.02.05 16:59 
Titel: Es geht mit der Methode Assign
Hallo,

ich habe mir die Lösung selbst erarbeitet:

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:
procedure TForm1.Button2Click(Sender: TObject);

var neudbf : TTable;

var datenbank, tabelle : String;

begin

Ziel.active := False;

batchmove.Source := Quelle;

batchmove.mode := batcopy;

datenbank := 'dbase';

tabelle := 'neu';

Neudbf := TTable.Create(self);
Neudbf.DatabaseName := datenbank;

Neudbf.Tabletype := TTDBase;

Neudbf.TableName := Tabelle;
Neudbf.FieldDefs.Assign(Quelle.FieldDefs);

// Neudbf.IndexDefs.Assign(Quelle.IndexDefs); // !!!!!

Neudbf.CreateTable;

batchmove.destination := Neudbf;

batchmove.execute;

end;


Jetzt funzt es !

Ralli

Moderiert von user profile iconraziel: Code- durch Delphi-Tags ersetzt.