Erro no delphi berlin de DataSet not in edit or insert mode
20/05/2022
0
Olá Pessoal, bom recentemente comecei um projeto no delphi uso o berlin
é nesse meio tempo já vem dando erros que consegui resolver, mas esse
está federal rsrs, é esse
OBS: É não pude colocar aspas pois o forúm não deixou
Project Projeto.exe raised exception class EDatabaseError with message cItens: Dataset not in edit or insert mode.
bom já tentei trocar o insert para edit mas mesmo assim o mesmo erro continua
procedure TFLanItem.btSalvarClick(Sender: TObject);
begin
if edCod.Text=then
begin
ShowMessage(CÓDIGO DO PRODUTO NÃO INFORMADO!);
edCod.SetFocus;
Exit;
end;
if edDescricao.Text=then
begin
ShowMessage(NOME DO PRODUTO NÃO INFORMADO!);
edDescricao.SetFocus;
Exit;
end;
if edValor.Text=0,00 then
begin
ShowMessage(VALOR DO PRODUTO NÃO INFORMADO!);
edValor.SetFocus;
Exit;
end;
if edQtd.Text=0 then
begin
ShowMessage(QUANTIDADE DO PRODUTO NÃO INFORMADO!);
edQtd.SetFocus;
Exit;
end;
if edTotal.Text=0,00 then
begin
ShowMessage(TOTAL DO PRODUTO NÃO INFORMADO!);
edTotal.SetFocus;
Exit;
end;
if dm.cItens.State=dsInsert then
begin
dm.cItens.Append;
dm.cItensID_ITEM.AsInteger:=dm.qryGenIdItemID.AsInteger;
end;
dm.cItensID_PRODUTO.AsInteger := StrToInt(edCod.Text);
dm.cItensQUANTIDADE.AsInteger := StrToInt(edQtd.Text);
dm.cItensVALOR.AsFloat := StrToFloat(edValor.Text);
dm.cItensTOTAL.AsFloat := StrToFloat(edTotal.Text);
dm.cItensDESCRICAO.AsString := edDescricao.Text;
dm.cItens.First;
ShowMessage(INFORMAÇÕES ARMAZENADAS COM SUCESSO!);
Close;
Ele está pulando esse bloco não está lendo
if dm.cItens.State=dsInsert then
begin
dm.cItens.Append;
dm.cItensID_ITEM.AsInteger:=dm.qryGenIdItemID.AsInteger;
end;
E depois já vai para seguinte linha
dm.cItensID_PRODUTO.AsInteger := StrToInt(edCod.Text);
porque onde era para gerar não está gerando e acaba dando o erro
Quem poder me ajudar ficarei grato! :)
é nesse meio tempo já vem dando erros que consegui resolver, mas esse
está federal rsrs, é esse
OBS: É não pude colocar aspas pois o forúm não deixou
Project Projeto.exe raised exception class EDatabaseError with message cItens: Dataset not in edit or insert mode.
bom já tentei trocar o insert para edit mas mesmo assim o mesmo erro continua
procedure TFLanItem.btSalvarClick(Sender: TObject);
begin
if edCod.Text=then
begin
ShowMessage(CÓDIGO DO PRODUTO NÃO INFORMADO!);
edCod.SetFocus;
Exit;
end;
if edDescricao.Text=then
begin
ShowMessage(NOME DO PRODUTO NÃO INFORMADO!);
edDescricao.SetFocus;
Exit;
end;
if edValor.Text=0,00 then
begin
ShowMessage(VALOR DO PRODUTO NÃO INFORMADO!);
edValor.SetFocus;
Exit;
end;
if edQtd.Text=0 then
begin
ShowMessage(QUANTIDADE DO PRODUTO NÃO INFORMADO!);
edQtd.SetFocus;
Exit;
end;
if edTotal.Text=0,00 then
begin
ShowMessage(TOTAL DO PRODUTO NÃO INFORMADO!);
edTotal.SetFocus;
Exit;
end;
if dm.cItens.State=dsInsert then
begin
dm.cItens.Append;
dm.cItensID_ITEM.AsInteger:=dm.qryGenIdItemID.AsInteger;
end;
dm.cItensID_PRODUTO.AsInteger := StrToInt(edCod.Text);
dm.cItensQUANTIDADE.AsInteger := StrToInt(edQtd.Text);
dm.cItensVALOR.AsFloat := StrToFloat(edValor.Text);
dm.cItensTOTAL.AsFloat := StrToFloat(edTotal.Text);
dm.cItensDESCRICAO.AsString := edDescricao.Text;
dm.cItens.First;
ShowMessage(INFORMAÇÕES ARMAZENADAS COM SUCESSO!);
Close;
Ele está pulando esse bloco não está lendo
if dm.cItens.State=dsInsert then
begin
dm.cItens.Append;
dm.cItensID_ITEM.AsInteger:=dm.qryGenIdItemID.AsInteger;
end;
E depois já vai para seguinte linha
dm.cItensID_PRODUTO.AsInteger := StrToInt(edCod.Text);
porque onde era para gerar não está gerando e acaba dando o erro
Quem poder me ajudar ficarei grato! :)
João
Curtir tópico
+ 0
Responder
Post mais votado
Clique aqui para fazer login e interagir na Comunidade :)