Ver Mensaje Individual
  #1  
Antiguo 27-09-2013
Avatar de pmtzg
pmtzg pmtzg is offline
Miembro
 
Registrado: jul 2007
Posts: 179
Reputación: 17
pmtzg Va por buen camino
Conectar SQLConnection a Firebird

hola compañeros
tengo la duda de como conectar una base de datos por medio de codigo
uso Delphi XE2 y Firebird 2.5


estos son mis ejemplos

Código Delphi [-]
procedure TForm1.Button1Click(Sender: TObject);
begin

SQLConnection1.DriverName := 'Firebird';
SQLConnection1.Params.Values['Database'] := 'servidor:C:\Datos\clientes\EMPRE01.FDB';
SQLConnection1.Params.Values['USER_NAME'] := 'SYSDBA';
SQLConnection1.Params.Values['PASSWORD'] := 'MASTERKEY';
SQLConnection1.LibraryName := 'dbxfb.dll';
SQLConnection1.LoginPrompt := false;
SQLConnection1.Open;
 TRY
  begin
    SQLConnection1.Connected := true;
    showmessage('conectado');
  end;
 except
    showmessage('error');
 END;
end;

o este es el correcto

Código Delphi [-]
procedure TForm1.Button2Click(Sender: TObject);
begin
    SQLConnection1.DriverName := 'Firebird';
    SQLConnection1.Params.Add('USER_NAME := SYSDBA');
    SQLConnection1.Params.Add('PASSWORD := MASTERKEY');
    SQLConnection1.Params.Add('Database := servidor:C:\Datos\clientes\EMPRE01.FDB');
    SQLConnection1.LibraryName := 'dbxfb.dll';
    SQLConnection1.LoginPrompt := false;
    SQLConnection1.Open;
 TRY
  begin
    SQLConnection1.Connected := true;
    showmessage('conectado');
  end;
 except
    showmessage('error');
 END;    
end;

que me falta o que estoy haciendo mal .. gracias por su tiempo
Responder Con Cita