Fórum SQLConnection: There is no Active Transaction #384442
24/08/2010
0
No meu sistema quando estou gravando a venda ele já inclui o contas a receber se estiver parcelado em mais de duas parcelas o sistema da o seguinte erro: "SQLConnection: There is no Active Transaction", não estou conseguindo encontrar o que pode estar ocasionando esse erro, alguem poderia me ajudar, já procurei aqui no Forum e não encontrei.
Desde já agradeço a ajuda de todos.
George Medeiros
Curtir tópico
+ 0Posts
24/08/2010
Marco Salles
Gostei + 0
24/08/2010
George Medeiros
procedure TDM.InsereVenda;
var
idvenda :Integer;
begin
idvenda := 0;
Start;
try
with spIUVenda do
begin
Params[0].AsInteger := cdsVendaID_VENDA.AsInteger;
Params[1].AsInteger := cdsVendaID_FUNCIONARIO.AsInteger;
Params[2].AsInteger := cdsVendaID_CLIENTE.AsInteger;
Params[3].AsInteger := cdsVendaID_PLANOPAGAMENTO.AsInteger;
Params[4].AsInteger := cdsVendaID_FORMAPAGAMENTO.AsInteger;
Params[5].AsInteger := cdsVendaID_ORCAMENTO.AsInteger;
Params[6].AsBCD := cdsVendaDESCONTOPERC.AsCurrency;
Params[7].AsBCD := cdsVendaVL_DESCONTO.AsCurrency;
Params[8].AsBCD := cdsVendaVL_TOTAL.AsCurrency;
Params[9].AsDate := cdsVendaDT_VENDA.AsDateTime;
Params[10].AsString := cdsVendaNUMNF.AsString;
Params[11].AsString := cdsVendaTEMORCAMENTO.AsString;
ExecProc;
Comit;
idvenda := Params[12].AsInteger;
end;
except
Rollback;
end;
//Insere Item
Start;
try
cdsItemVenda.First;
while not cdsItemVenda.Eof do
begin
with spIUItemVenda do
begin
Params[0].AsInteger := cdsItemVendaID_ITEMVENDA.AsInteger;
Params[1].AsInteger := idvenda;
Params[2].AsInteger := cdsItemVendaID_PRODUTO.AsInteger;
Params[3].AsBCD := cdsItemVendaQUANTIDADE.AsCurrency;
Params[4].AsBCD := cdsItemVendaVL_UNIT.AsCurrency;
Params[5].AsBCD := cdsItemVendaDESCONTOPERC.AsCurrency;
Params[6].AsBCD := cdsItemVendaVL_DESCONTO.AsCurrency;
Params[7].AsBCD := cdsItemVendaVL_TOTAL.AsCurrency;
ExecProc;
end;
DiminuiQuantidade(1,1, cdsItemVendaID_PRODUTO.AsInteger, cdsItemVendaQUANTIDADE.AsCurrency);
cdsItemVenda.Next;
end;
except
Rollback;
DeletaVenda(idvenda, 'N');
end;
//insere contas a receber
Start;
try
cdsContaReceder.First;
while not cdsContaReceder.Eof do
begin
with spIUContaReceber do
begin
Params[0].AsInteger := cdsContaRecederID_CONTARECEBER.AsInteger;
Params[1].AsInteger := cdsContaRecederID_EMPRESA.AsInteger;
Params[2].AsInteger := cdsContaRecederID_CLIENTE.AsInteger;
Params[3].AsInteger := cdsContaRecederID_CENTROCUSTO.AsInteger;
Params[4].AsInteger := cdsContaRecederID_FORMAPAGAMENTO.AsInteger;
Params[5].AsInteger := cdsContaRecederID_FUNCIONARIO.AsInteger;
Params[6].AsInteger := idvenda;
Params[7].AsString := cdsContaRecederNUMDOC.AsString;
Params[8].AsDate := cdsContaRecederDT_EMISSAO.AsDateTime;
Params[9].AsDate := cdsContaRecederDT_VENCIMENTO.AsDateTime;
Params[10].AsBCD := cdsContaRecederVALOR.AsCurrency;
Params[11].AsBCD := 0.00;
Params[12].AsBCD := 0.00;
Params[13].AsBCD := 0.00;
Params[14].AsBCD := 0.00;
Params[15].AsString := 'A';
ExecProc;
Comit;
end;
cdsContaReceder.Next;
end;
except
Rollback;
DeletaVenda(idvenda, 'N');
end;
end;
Gostei + 0
24/08/2010
George Medeiros
Gostei + 0
24/08/2010
Marco Salles
Gostei + 0
27/08/2010
George Medeiros
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)