Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Varios (https://www.clubdelphi.com/foros/forumdisplay.php?f=11)
-   -   Crear una B.D. con paradox (https://www.clubdelphi.com/foros/showthread.php?t=3394)

CFPA86 04-09-2003 21:42:03

Crear una B.D. con paradox
 
Hola foristas de Delphi.


Como creo y destruyo en tiempo de ejecuccion, mediante codigo una base de datos en paradox donde le pueda agregar campos.

Les agradezco la atencion que le puedan ofrecer a este mensaje, gracias

Gregory Mazon 05-09-2003 01:17:26

Espero te sirva
para Crearla :

Procedure Crea;
FBase := TTable.Create(Self);
with FBase do begin
Active := False;
TableType := ttParadox;
TableName := 'Temporal.db'

if not FBase.Exists then begin
with FieldDefs do begin
Clear;
with AddFieldDef do begin
Name := Codigo';
DataType := ftString;
Size := 15;
end;
with AddFieldDef do begin
Name := 'Descripcion';
DataType := ftString;
Size := 30;
end;
with AddFieldDef do begin
Name := 'Cantidad';
DataType := ftFloat;
end;
with AddFieldDef do begin
Name := 'Precio';
DataType := ftFloat;
end;
with AddFieldDef do begin
Name := 'Importe';
DataType := ftFloat;
end;
end;
CreateTable;
end;
end;


Y PARA DESTRUIRLA :


procedure xxx.FormClose(Sender: TObject; var Action: TCloseAction);
Var
F : TextFile;
begin
inherited;
if Assigned(Fbase) Then Begin
AssignFile(F, FBase.Database.Directory+'\'+FBase.TableName);
FBase.Close();
Erase(F);
End;
Action := caFree;
end;

CFPA86 05-09-2003 15:41:18

Hola foristas; gracias a todos y especialmente a Gregory, voy a probar este codigo si me funciona si es asi se los dire por este mismo medio.

Muchas gracias

CFPA86 06-09-2003 15:19:04

Se puede dar este mensaje como terminado, me funciona este codigo, gracias por todo.


La franja horaria es GMT +2. Ahora son las 23:36:42.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi