- Conexión a MS SQL Server guardada en configuración
git-svn-id: https://192.168.0.254/svn/Proyectos.FarmaciaPH_Etiquetas/trunk@25 7b0b1a58-4aa1-b946-8089-8453ede31e50
This commit is contained in:
parent
23962cc222
commit
933db1660d
@ -38,9 +38,10 @@ type
|
||||
private
|
||||
FEscribirLog : TCriticalSection;
|
||||
FConnectionName : string;
|
||||
function GetConnectionString: string;
|
||||
//function GetConnectionString: string;
|
||||
procedure IniciarLog;
|
||||
procedure DetenerLog;
|
||||
procedure DetenerLog;
|
||||
procedure CrearConexiones;
|
||||
public
|
||||
FDBServer : string;
|
||||
FDBPort : string;
|
||||
@ -160,6 +161,33 @@ begin
|
||||
Connection.RollbackTransaction;
|
||||
end;
|
||||
|
||||
procedure TdmServer.CrearConexiones;
|
||||
var
|
||||
AConn : String;
|
||||
begin
|
||||
//IBX
|
||||
AConn := 'IBX?Server=' + FDBServer + '/' + FDBPort
|
||||
+ ';Database=' + FDBPath
|
||||
+ ';UserID=' + FDBUser
|
||||
+ ';Password=' + Decrypt(FDBPass)
|
||||
+ ';Dialect=3;Charset=ISO8859_1;';
|
||||
ConnectionManager.Connections.ConnectionByName('IBX').ConnectionString := AConn;
|
||||
|
||||
//MSSQL
|
||||
//ADO?AuxDriver=SQLOLEDB.1;Server=ROB_VM_FARMACIA\FARMATIC;Database=farmatic;UserID=rodax;Password=rodax;
|
||||
//ADO?AuxDriver=SQLOLEDB.1;Server=ROB_VM_FARMACIA\FARMATIC;Database=farmatic;Integrated Security=SSPI
|
||||
|
||||
AConn := 'ADO?AuxDriver=SQLOLEDB.1;Server=' + FMSSQLServer
|
||||
+ ';Database=' + FMSSQLPath;
|
||||
|
||||
if FMSSQLIntSecurity = 1 then
|
||||
AConn := AConn + ';Integrated Security=SSPI'
|
||||
else
|
||||
AConn := AConn + ';UserID=' + FMSSQLUser
|
||||
+ ';Password=' + Decrypt(FMSSQLPass);
|
||||
ConnectionManager.Connections.ConnectionByName('FARMATIC').ConnectionString := AConn;
|
||||
end;
|
||||
|
||||
function TdmServer.DarNuevaConexion: IDAConnection;
|
||||
begin
|
||||
with ConnectionManager do
|
||||
@ -186,7 +214,7 @@ begin
|
||||
IniciarLog;
|
||||
end;
|
||||
|
||||
function TdmServer.GetConnectionString: string;
|
||||
{function TdmServer.GetConnectionString: string;
|
||||
begin
|
||||
Result := 'IBX?Server=' + FDBServer + '/' + FDBPort
|
||||
+ ';Database=' + FDBPath
|
||||
@ -194,12 +222,7 @@ begin
|
||||
+ ';Password=' + Decrypt(FDBPass)
|
||||
+ ';Dialect=3;Charset=ISO8859_1;';
|
||||
|
||||
{ Result := 'FIB?Server=' + FDBServer + '/' + FDBPort
|
||||
+ ';Database=' + FDBPath
|
||||
+ ';UserID=' + FDBUser
|
||||
+ ';Password=' + Decrypt(FDBPass)
|
||||
+ ';Dialect=3;Charset=ISO8859_1;';}
|
||||
end;
|
||||
end;}
|
||||
|
||||
procedure TdmServer.LeerConfiguracion;
|
||||
begin
|
||||
@ -294,10 +317,10 @@ end;
|
||||
procedure TdmServer.RefrescarConexion;
|
||||
begin
|
||||
HTTPServer.Active := False;
|
||||
ConnectionManager.Connections.GetDefaultConnection.ConnectionString := '';
|
||||
|
||||
CrearConexiones;
|
||||
|
||||
ConnectionName := ConnectionManager.GetDefaultConnectionName;
|
||||
ConnectionManager.Connections.GetDefaultConnection.ConnectionString := GetConnectionString;
|
||||
|
||||
if not ROIsService then
|
||||
ShowBalloonHint('Conectado a ' + ConnectionName, bfInfo);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user