[firebase-br] SP retonando Dado Inserido
Gladiston Santana
gladiston em vidy.com.br
Qua Set 12 17:58:11 -03 2012
Só para ter certeza que não retorna nada, faça esse pequeno teste :
SQLExec.Close;
SQLExec.SQL.Clear;
SQLExec.SQL.Add('SELECT campo_retornavel FROM
SP_OS_GERAR(:PLACA,:KM)');
SQLExec.ParamByName('PLACA').**AsString := Trim(Viatura);
SQLExec.ParamByName('KM').**AsInteger := StrToInt(KM);
SQLExec.Open
while not SQLExec.eof do
begin
ShowMessage(SQLExec.FieldbyName('campo_retornavel').AsString)
SQLExec.Next;
end;
Também tô achando que você fez confusão com componentes.
Em 12 de setembro de 2012 16:11, <viniciusf em grupojvp.com.br> escreveu:
> Na verdade eu fiz usando isso também... mas continua gerando exeption
> dentro do delphi...
>
> Meu codigo de chamar a SP está assim... (DELPHI)
>
>
> procedure TDMP.GerarNovaOS;
> var
> Viatura: String;
> KM: String;
> begin
> InputQuery('ORDEM DE SERVIÇO', 'Digite a placa da Viatura:', Viatura);
> InputQuery('ORDEM DE SERVIÇO', 'Digite o KM da Viatura:', KM);
> if (Viatura <> '') and (KM <> '') then
> begin
> //
> StrToInt(KM);
> SQLExec.Close;
> SQLExec.SQL.Clear;
> SQLExec.SQL.Add('SELECT * FROM SP_OS_GERAR(:PLACA,:KM)');
> SQLExec.ParamByName('PLACA').**AsString := Trim(Viatura);
> SQLExec.ParamByName('KM').**AsInteger := StrToInt(KM);
> SQLExec.Open;
> cdsExec.Open;
> if cdsExec.RecordCount > 0 then
> begin
> if SelecOS(cdsExec.FieldByName('**COD').AsInteger) then
> begin
> PreencherVisaoOS;
> frmOS.ShowModal;
> end;
> end;
> end;
> PreencherVisaoOS;
> //
> end;
>
> O que pensei... se retornar alguma coisa quer dizer que inseriu... se
> inseriu eu pego o codigo da OS e abro ela para o usuário...
>
> mas sempre que executo dessa forma tras exception que não deveriam
> aparecer... qd executo dessa forma... funciona normal...
>
>
> procedure TDMP.GerarNovaOS;
> var
> Viatura: String;
> KM: String;
> begin
> InputQuery('ORDEM DE SERVIÇO', 'Digite a placa da Viatura:', Viatura);
> InputQuery('ORDEM DE SERVIÇO', 'Digite o KM da Viatura:', KM);
> if (Viatura <> '') and (KM <> '') then
> begin
> //
> StrToInt(KM);
> SQLExec.Close;
> SQLExec.SQL.Clear;
> SQLExec.SQL.Add('EXECUTE PROCEDURE SP_OS_GERAR(:PLACA,:KM)');
> SQLExec.ParamByName('PLACA').**AsString := Trim(Viatura);
> SQLExec.ParamByName('KM').**AsInteger := StrToInt(KM);
> SQLExec.ExecSQL;
> end;
> PreencherVisaoOS;
> //
> end;
>
>
> Quando executo a SP no IBExpert funciona normal retornando... mas pelo
> delphi não...
>
>
>
>
>
>
> Em 12.09.2012 15:58, Tallys Ferrante escreveu:
>
>
>> http://www.firebirdsql.org/**refdocs/langrefupd21-insert.**
>> html#langrefupd21-insert-**returning<http://www.firebirdsql.org/refdocs/langrefupd21-insert.html#langrefupd21-insert-returning>
>>
>> acho que isso pode te ajudar
>> ______________________________**________________
>> FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br
>> Para saber como gerenciar/excluir seu cadastro na lista, use:
>> http://www.firebase.com.br/fb/**artigo.php?id=1107<http://www.firebase.com.br/fb/artigo.php?id=1107>
>> Para consultar mensagens antigas: http://firebase.com.br/**pesquisa<http://firebase.com.br/pesquisa>
>>
>
>
> ______________________________**________________
> FireBase-BR (www.firebase.com.br) - Hospedado em www.locador.com.br
> Para saber como gerenciar/excluir seu cadastro na lista, use:
> http://www.firebase.com.br/fb/**artigo.php?id=1107<http://www.firebase.com.br/fb/artigo.php?id=1107>
> Para consultar mensagens antigas: http://firebase.com.br/**pesquisa<http://firebase.com.br/pesquisa>
>
Mais detalhes sobre a lista de discussão lista