Ver Mensaje Individual
  #11  
Antiguo 12-12-2010
Paulao Paulao is offline
Miembro
 
Registrado: sep 2003
Ubicación: Rua D 31 Casa 1 - Inhoaíba - Rio de Janeiro - RJ - Brasil
Posts: 637
Reputación: 23
Paulao Va por buen camino
Este es mi archivo .INI de conexion en el banco de datos
Código Delphi [-]
[SqlServer]
DriverName=MsSql
HostName=INETSOFTWARE-PC\SQLExpress
DataBase=Global_Cosmeticos
User_Name=sa
Password=simbad
OS Authentication=True
Y este es mi codigo no OnBeforeConnect del TSqlConnection
Código Delphi [-]
procedure TDM_Principal.SQLConnection1BeforeConnect(Sender: TObject);
var
 arq_conexao: TiniFile;
 path,
 banco,
 arquivo: String;
begin
  conexao := Sqlconnection1;
  path := ExtractFilePath(Application.ExeName);
  arquivo := path + ExtractFileName('Conexao_Global.ini');
  arq_conexao := TIniFile.Create(arquivo);

  banco := arq_conexao.ReadString('conexao_atual','banco_atual','');
  if banco = 'SqlServer' then
  begin
    //SqlConnection1.ConnectionName                          := 'Mairibel';
    //SqlConnection1.DriverName                              := 'MSSQL';
    //SqlConnection1.GetDriverFunc                           := 'getSQLDriverMSSQL';
    //SqlConnection1.LibraryName                             := 'dbxmss30.dll';
    //SqlConnection1.LoginPrompt                             := False;
    //SqlConnection1.VendorLib                               := 'OleDb';
    //SqlConnection1.Params.Values['DriverName']             := arq_conexao.ReadString('SqlServer','DriverName','');
    SqlConnection1.Params.Values['HostName']               := arq_conexao.ReadString('SqlServer','HostName','');
    SqlConnection1.Params.Values['DataBase']               := arq_conexao.ReadString('SqlServer','DataBase','');
    SqlConnection1.Params.Values['User_Name']              := arq_conexao.ReadString('SqlServer','User_Name','');
    SqlConnection1.Params.Values['Password']               := arq_conexao.ReadString('SqlServer','password','');
    SqlConnection1.Params.Values['OS Authentication']      := arq_conexao.ReadString('SqlServer','OS Authentication','');
  end;
end;
Responder Con Cita