[firebase-br] SP retonando Dado Inserido
viniciusf em grupojvp.com.br
viniciusf em grupojvp.com.br
Qua Set 12 16:11:02 -03 2012
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
>
> 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
> Para consultar mensagens antigas: http://firebase.com.br/pesquisa
Mais detalhes sobre a lista de discussão lista