Divergence between versions of Delphi - Datasnap

Asked

Viewed 101 times

3

Sqlserver database to proc receives a single parameter which is the guy’s registration and returns the balance.

Very simple, but here on Delphi XE8 with Datasnap only returns zero and on other platforms like ASP.NET C# , Delphi 2010 the same proc is used and returns the correct value.

SQL command:

SELECT SUM(CASE Fl_Credito WHEN 1 THEN Vl_Movimento ELSE 0 END) - SUM(CASE Fl_Credito WHEN 0 THEN Vl_Movimento ELSE 0 END)
    AS Vl_Saldo
    FROM tb_MOTOQUEIRO_MOVIMENTO
    WHERE NR_MATRICULA = @PIntMatricula

Call on the Delphi:

  with DmBusca.cdsMotoSaldo do
  begin
    close;
    Params[0].AsInteger := StrToInt(edtMATRICULA.Text);
    Open;
    edtSaldo.Text := FloatToStr(FieldByName('vl_saldo').AsFloat);
  end;
  • If you select directly, without using parameters, setting the value of NR_MATRICULA in select, what it returns ?

  • Dento do Delphi Xe always returns 0 but as I said this proc is from 2008 and works on other platforms perfectly including in Delphi 2010

  • 4

    Only I found the title of the question poorly asked?

  • Will it return 0 even if you fail the value of the parameter in commandtext? I’ve seen cases where the "problem" was in the Params[]

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.