GARANTIR DESCONTO

Fórum EIBInterbaseError #336871

29/01/2007

0

:? Oi estou começando a programar e estou com um problema, eu coloquei para editar um dbgrid p/ eu alterar os dados, consigo inserir os dados, modificar mas ele não atualiza o banco de dados, quando eu fecho o form e depois abro novamente as informções que inseri não foi atualizada, eu perco as alterações que fiz.
Eu estou usando Firebird 1.5 os componentes:

TIBQuery, IBUpdateSQL1,DataSource1 da o seguinte erro:

Project Sistema.exe raised exception class EIBInterbaseError with message ´internal error´.

no comando onexit do dbgrid eu coloquei o seguinte codigo:
 ibqryBusca.ApplyUpdates;

na TIBQuery eu coloquei :
select * from  ORD_SERVICO

e o meu codigo esta da seguinte forma:
procedure TfrmConsultaOS.btnConsultarClick(Sender: TObject);
var i : integer;
begin

      if (Trim(edtOS.Text)= ´´)and
          (Trim(edtDPR.Text)=´´)and
          (Trim(edtCia.Text)= ´´)and
          (Trim(edtCliente.Text)= ´´)  then

          begin
            ShowMessage(´É necessário informar pelo menos um ´+#13+ ´dos campos para fazer a pesquisa!´);
            Exit;

          end;

          with ibqryBusca do

          begin
            Close;
            SQL.Clear;
            SQL.Add(´select * from ORD_SERVICO´);

            if Trim(edtOS.Text)<>´´ then

            begin
              if Pos(´h´,SQL.Text)<>0 then

              SQL.Add(´and IDOS =:IDOS´)

              else

              SQL.Add(´Where IDOS =:IDOS´);
              ParamByName(´IDOS´).Value:= StrToInt(edtOS.Text);
            end;

              if Trim(edtDPR.Text)<>´´ then

              begin
                if Pos(´h´,SQL.Text)<>0 then
                SQL.Add(´and DPR like:DPR´)

                else
                  SQL.Add(´Where DPR like:DPR´);
                  ParamByName(´DPR´).Value:= edtDPR.Text + ´¬´;
              end;

               if Trim(edtCia.Text)<>´´ then

              begin
                if Pos(´h´,SQL.Text)<>0 then
                SQL.Add(´and CIA like:CIA´)

                else
                  SQL.Add(´Where CIA like:CIA´);
                  ParamByName(´CIA´).Value:= edtCia.Text + ´¬´;
          end;

                if Trim(edtCliente.Text)<>´´ then

              begin
                if Pos(´h´,SQL.Text)<>0 then
                SQL.Add(´and CLIENTE like:CLIENTE´)

                else
                  SQL.Add(´Where CLIENTE like:CLIENTE´);
                  ParamByName(´CLIENTE´).Value:= edtCliente.Text + ´¬´;
              end;


          end;

    try
      ibqryBusca.Open;
      Except
      On E: Exception do
      ShowMessage(E.Message);
    end;
     for i:= 0 to Panel1.ComponentCount-1 do
    begin
     if (Panel1.Components[i] is TEdit) then
         TEdit(Panel1.Components[i]).Clear;
    end;



    end;





procedure TfrmConsultaOS.btnFecharClick(Sender: TObject);
begin
    Close;
end;

procedure TfrmConsultaOS.DBGrid1Exit(Sender: TObject);
begin
      ibqryBusca.ApplyUpdates;
end;

procedure TfrmConsultaOS.BitBtn1Click(Sender: TObject);
begin
       ShowMessage(´Não esqueça de ligar a impressora!´);
     rvConsultaOS.ProjectFile := ´rvConsultaOS.rav´;
      rvConsultaOS.Execute;
end;

procedure TfrmConsultaOS.BitBtn2Click(Sender: TObject);


  var i : integer;
begin

      if (Trim(edtOS.Text)= ´´)and
          (Trim(edtDPR.Text)=´´)and
          (Trim(edtCia.Text)= ´´)and
          (Trim(edtCliente.Text)= ´´)  then

          begin
            ShowMessage(´É necessário informar pelo menos um ´+#13+ ´dos campos para fazer a pesquisa!´);
            Exit;

          end;

          with ibqryBusca do

          begin
            Close;
            SQL.Clear;
            SQL.Add(´select * from ORD_SERVICO´);

            if Trim(edtOS.Text)<>´´ then

            begin
              if Pos(´h´,SQL.Text)<>0 then

              SQL.Add(´and IDOS =:IDOS´)

              else

              SQL.Add(´Where IDOS =:IDOS´);
              ParamByName(´IDOS´).Value:= StrToInt(edtOS.Text);
            end;

              if Trim(edtDPR.Text)<>´´ then

              begin
                if Pos(´h´,SQL.Text)<>0 then
                SQL.Add(´and DPR like:DPR´)

                else
                  SQL.Add(´Where DPR like:DPR´);
                  ParamByName(´DPR´).Value:= edtDPR.Text + ´¬´;
              end;

               if Trim(edtCia.Text)<>´´ then

              begin
                if Pos(´h´,SQL.Text)<>0 then
                SQL.Add(´and CIA like:CIA´)

                else
                  SQL.Add(´Where CIA like:CIA´);
                  ParamByName(´CIA´).Value:= edtCia.Text + ´¬´;
          end;

                if Trim(edtCliente.Text)<>´´ then

              begin
                if Pos(´h´,SQL.Text)<>0 then
                SQL.Add(´and CLIENTE like:CLIENTE´)

                else
                  SQL.Add(´Where CLIENTE like:CLIENTE´);
                  ParamByName(´CLIENTE´).Value:= edtCliente.Text + ´¬´;
              end;


          end;

    try
      ibqryBusca.Open;
      Except
      On E: Exception do
      ShowMessage(E.Message);
    end;

     for i:= 0 to Panel1.ComponentCount-1 do
    begin
     if (Panel1.Components[i] is TEdit) then
         TEdit(Panel1.Components[i]).Clear;
    end;



    end;


Mary
montesdesigners@ig.com.br


Mary

Mary

Responder

Utilizamos cookies para fornecer uma melhor experiência para nossos usuários, consulte nossa política de privacidade.

Aceitar