Código Delphi
[-]
procedure TFSucursal.BitBtn3Click(Sender: TObject);
var
sSQL, sFROM, sWHERE, sORDER, sEsquema,sent: string;
begin
sSQL := EmptyStr;
sFROM := EmptyStr;
sWHERE := EmptyStr;
sORDER := EmptyStr;
sEsquema := 'dba.';
sSQL := 'select * ';
sFROM := 'from '+sEsquema+'sucursal_mh ';
sWHERE:= 'where 0 = 0 ';
if not ( Trim( DBLFiltra_sucursal.Text ) = EmptyStr ) then
sWHERE := sWHERE + 'and cod_sucursal_mh = '+ (DBLFiltra_sucursal.KeyValue);
sORDER := ' order by des_sucursal_mh';
DMSucursales.QrySucursal_MH.SQL.Clear;
DMSucursales.QrySucursal_MH.SQL.Add ( sSQL + sFROM + sWHERE + sORDER );
DMSucursales.CDSsucursal_mh.Close;
sent:=(sSQL+sFROM+sWHERE+sORDER);
ShowMessage(sent);
UCerrarAbrirPG(DMSucursales.CDSsucursal_mh, Self);
Código Delphi
[-]
procedure UCerrarAbrirPG(DataSet: TDataSet; Sender : TForm);
var
nombre, ErrorM : string;
begin
ErrorM := '';
nombre := DataSet.Name;
if BaseDatosPG.InTransaction then
begin
try
DataSet.Close;
except
on E: Exception do
UAbrirMensaje('Error al cerrar el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
end;
try
DataSet.Open;
except
on E: Exception do
UAbrirMensaje('Error al abrir el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
end;
end
else
begin
try
DataSet.Close;
except
on E: Exception do
UAbrirMensaje('Error al cerrar el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
end;
IniciarTransaccionPG;
try
BaseDatosPG.StartTransaction(TDPG);
DataSet.Open;
BaseDatosPG.Commit(TDPG);
except
on E: Exception do
begin
BaseDatosPG.Rollback(TDPG);
UAbrirMensaje('Error al abrir el componente '+nombre+'.'+#13+#10+'Mensaje : '+E.Message,ierror,sender);
end;
end;
end;
end;
Edito este mensaje para añadir las etiquetas [ delphi ].