[firebase-br] SP retonando Dado Inserido
Nilson Sérgio Silva
adm.nilsonsergio em gmail.com
Qua Set 12 16:17:09 -03 2012
Acredito q o problema ai é no componente de acesso vc deve usar um Query e
não um SQLExec, pois este não retorna um cursor.
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>
>
--
*
Nilson Sérgio da Silva - Diretor*
*Fone: *(88) 3512.4849 / 8822.1801
*MSN: *nilsonsergio em pop.com.br
*Skype: *nilson.sergio
*Site: *www.esosistemas.com.br
Mais detalhes sobre a lista de discussão lista