ERRO:
multiple rows in singleton select at procedure "MOV_PRODUTOS"

PROCEDURE MOVIMENTA
procedure TFrmProdutos.Movimenta(VTipo:String; VCodigo:Integer;
VNome:String;Vordem:Integer);
begin
D_M.MOV_produtos.ParamByName('VTIPO').AsString:=VTipo;
D_M.MOV_produtos.ParamByName('VCODIGO').AsInteger:=VCodigo;
D_M.MOV_produtos.ParamByName('VNOME').AsString:=VNome;
D_M.MOV_produtos.ParamByName('VORDEM').AsInteger:=Vordem;
D_M.MOV_produtos.ExecProc;
end;

seguinte, eu teste se o produto ja existe com este nome
VPri:=D_M.Qprodutosproduto.AsString;
if ((VPri='') or (VPri=' ')) and not Bcancela.Focused
then Begin
MessageBeep(32);
MessageDlg('Produto Inválido',mtError,[mbOk],0);
DBNome.SetFocus;
exit;
end;
Movimenta('NOME',0,D_M.Qprodutosproduto.AsString,ORDEM);
VCRetorno:=D_M.MOV_produtos.ParamByName('RCODIGO').AsInteger;
VNRetorno:=D_M.MOV_produtos.ParamByName('RNOME').AsString;
if ((VCRetorno>0) and (inclusao=1)) or ((inclusao=0) and (VCRetorno>0)
and (VCRetorno<>D_M.QprodutosCodigo.AsInteger)) and not
Bcancela.Focused then begin
MessageBeep(32);
MessageDlg('Produto com este Nome já Existente'+#10#13+#10#13+
'Código - '+IntToStr(VCRetorno)+#10#13+
'Nome - '+VNRetorno,mtError,[mbOk],0);
if messagedlg('Confirme!',mtconfirmation,[mbyes,mbno],0)=mrNO
then begin
DBNome.SetFocus;
exit;
end;
end;

QUANDO VOU TESTAR OUTRO CAMPO É QUE DA O ERRO, MAS O INTERESSANTE QUE
DA O ERRO, SE EU CONFIRMO QUE JA EXISTE
VPri:=D_M.QprodutosReffab.AsString;
if ((VPri<>'') and (VPri<and>0) and (inclusao=1)) or ((inclusao=0) and
(VCRetorno>0) and (VCRetorno<>D_M.QprodutosCodigo.AsInteger)) and not
Bcancela.Focused then begin
MessageBeep(32);
MessageDlg('Referência de Fábrica com este Código já
Existente'+#10#13+#10#13+
'Código - '+IntToStr(VCRetorno)+#10#13+
'Nome - '+VNRetorno,mtError,[mbOk],0);
if messagedlg('Confirme!',mtconfirmation,[mbyes,mbno],0)=mrNO
then begin
DBNome.SetFocus;
exit;
end;
end;

*************PROCEDURE *************************

ELSE IF (:VTIPO='NOME') THEN
BEGIN
SELECT CODIGO,PRODUTO FROM PRODUTOS WHERE PRODUTO=:VNOME ORDER
BY PRODUTO INTO :RCODIGO,:RNOME;
SUSPEND;
END
ELSE IF (:VTIPO='REFFAB') THEN
BEGIN
SELECT CODIGO,PRODUTO FROM PRODUTOS WHERE REFFAB=:VNOME ORDER
BY REFFAB INTO :RCODIGO,:RNOME;
SUSPEND;
END


Responder a