tiene razon jachguate pero para que veas que somo umilde ahi va la ayuda:
Crea en un DataModule (File->New->DataModule) los siguientes componentes : IBDatabase,IBQuery yIBTransaction
con el siguiente codigo:
procedure TDM.DataModuleCreate(Sender: TObject);
procedure query (Q : String);
begin
DM.IBQuery.Active:= FALSE;
DM.IBQuery.SQL.Clear;
DM.IBQuery.SQL.Add(Q);
DM.IBQuery.Active:= TRUE;
DM.IBTransaction.CommitRetaining; //para que se ejecute lo anterior, y no quede en memoria
end;
var
strSQL :String;
begin
if not FileExists(ExtractFilePath(ParamStr(0))+'agenda.gdb')then
begin
DM.IBDatabase.DatabaseName:=ExtractFilePath(ParamStr(0))+'agenda.gdb';
DM.IBDatabase.Params.Clear; //IBDatabase1.Params de "CREACION"
DM.IBDatabase.Params.Add('USER "SYSDBA"');
DM.IBDatabase.Params.Add('PASSWORD "masterkey"');
DM.IBDatabase.Params.Add('PAGE_SIZE = 1024');
DM.IBDatabase.CreateDatabase;
DM.IBDatabase.Connected:= False;
DM.IBDatabase.DatabaseName:=ExtractFilePath(ParamStr(0))+'agenda.gdb';
DM.IBDatabase.Params.Clear; //FClientes.IBDatabase1.Params de "CONEXION"
DM.IBDatabase.Params.Add('user_name=SYSDBA');
DM.IBDatabase.Params.Add('password=masterkey');
DM.IBDatabase.Connected:= true; //primero
DM.IBTransaction.Active:= true; //segundo
//----------------------------------
strSQL := 'CREATE TABLE USUARIOS ('+
'USUARIO VARCHAR (10) NOT NULL,'+
'CLAVE VARCHAR (10) NOT NULL,'+
'EMPRESA VARCHAR (50) ,'+
'NOMBRE_COMPLETO VARCHAR(50),'+
'SECCION VARCHAR(50),'+
'NIVEL VARCHAR (50),'+
'WEB CHAR(1) DEFAULT ''0'','+
'PROCESOS CHAR(1) DEFAULT ''0'','+
'PRIMARY KEY(USUARIO));';
query(strSQL);
//----------------------------------
////////////////////////////////////////////////////////////////////////////////
DM.IBDatabase.Connected := True;
DM.IBTransaction.Active := True;
No te sientas mal todo cometemos errores
|