santi33a
17-05-2006, 13:40:34
Hola a todos:
Quisiera si alguien tiene una idea me ilumine pues no se que es lo que pasa, el caso es que desde delphi (v.7) llamo a un procedimiento almacenado en SQLServer 2000 de la sgte forma:
Código Delphi [-] (http://www.clubdelphi.com/foros/#)
procedure TFConfirma.BitOOkClick(Sender: TObject);
begin
inherited;
dm.pConfirmaP.Parameters.ParamByName('@Hasta').Value := dtHasta.Date;
dm.pConfirmaP.ExecProc;
if dm.pConfirmaP.Parameters.ParamByName('@RETURN_VALUE').Value = 0 then
begin
ShowMessage('Periodo Confirmado');
dm.pEmpresa.Open;
fechaE := dm.pEmpresafecha.Value;
FPpal.lfecha.Text := dm.pEmpresafecha.AsString;
dm.pEmpresa.Close;
end
else ShowMessage('Periodo no Confirmado');
end;
y en la BD SQL el procedimiento almacenado un poco simplificado es:
Código SQL [-] (http://www.clubdelphi.com/foros/#)
CREATE PROCEDURE pConfirmaPeriodo @Hasta smalldatetime AS
BEGIN
declare @Desde smalldatetime
declare @error int
declare @nTran varchar(20)
set @nTran = 'santi'
select @desde = fecha from Empresas
if @Desde < @Hasta
begin
begin tran @nTran
update Documentos
set CPerid = 1
where CPerid is null and fecha BetWeen @Desde and @Hasta
set @error = @@error
if @error = 0
begin
update Empresas
set fecha = @Hasta
set @error = @@error
end
if @error = 0
begin
commit tran @nTran
return 0
end
else
begin
rollback tran @nTran
return @@error
end
end
else
begin
raiserror('Error, configure la hora de su PC',16,1)
return 1
end
END
GO
el problema esta cuando algun update falla el procdimiento se interrumpe por lo que no llego a recibir ninguna información de retorno en delphi
Quisiera si alguien tiene una idea me ilumine pues no se que es lo que pasa, el caso es que desde delphi (v.7) llamo a un procedimiento almacenado en SQLServer 2000 de la sgte forma:
Código Delphi [-] (http://www.clubdelphi.com/foros/#)
procedure TFConfirma.BitOOkClick(Sender: TObject);
begin
inherited;
dm.pConfirmaP.Parameters.ParamByName('@Hasta').Value := dtHasta.Date;
dm.pConfirmaP.ExecProc;
if dm.pConfirmaP.Parameters.ParamByName('@RETURN_VALUE').Value = 0 then
begin
ShowMessage('Periodo Confirmado');
dm.pEmpresa.Open;
fechaE := dm.pEmpresafecha.Value;
FPpal.lfecha.Text := dm.pEmpresafecha.AsString;
dm.pEmpresa.Close;
end
else ShowMessage('Periodo no Confirmado');
end;
y en la BD SQL el procedimiento almacenado un poco simplificado es:
Código SQL [-] (http://www.clubdelphi.com/foros/#)
CREATE PROCEDURE pConfirmaPeriodo @Hasta smalldatetime AS
BEGIN
declare @Desde smalldatetime
declare @error int
declare @nTran varchar(20)
set @nTran = 'santi'
select @desde = fecha from Empresas
if @Desde < @Hasta
begin
begin tran @nTran
update Documentos
set CPerid = 1
where CPerid is null and fecha BetWeen @Desde and @Hasta
set @error = @@error
if @error = 0
begin
update Empresas
set fecha = @Hasta
set @error = @@error
end
if @error = 0
begin
commit tran @nTran
return 0
end
else
begin
rollback tran @nTran
return @@error
end
end
else
begin
raiserror('Error, configure la hora de su PC',16,1)
return 1
end
END
GO
el problema esta cuando algun update falla el procdimiento se interrumpe por lo que no llego a recibir ninguna información de retorno en delphi