ADOQuery Grid

Delphi

05/09/2003

Galera, estou tentando alimentar uma grid com o seguinte código:
if edtPesq.Text <> ´´ then
       begin
        with DtaObjetos do
        begin
           DtsGrid.DataSet := nil;
           oCn.Close;
           oCn.Connected := False;
           oCn.Connected := True;
           oCn.Open;
           with qryQuery do
           begin
            Active := False;
            Active := True;
            Close;
            SQL.Clear;
            SQL.Add(´Select * from tblaluno where nome like "´+ edtPesq.Text +´¬"´);
            Open;
         end;
           if not Eof then
               Begin
                  ShowMessage(´true´);
                  //DtsGrid.DataSet := qryQuery;
                  //dbgAluno.DataSource := DtsGrid;
               End
            else
               Begin
                  ShowMessage(´False´);
               End;

            //oCn.Close;
           //oCn.Connected := False;
           //qryQuery.Close;
           //qryQuery.Active := False;
        end;
        end
        else
           ShowMessage(´Por favor, digite algo´);
           edtPesq.SetFocus;
        end;


Qd verifico se o Query me retornou algum registro me dá um erro assim:
   Dataset does not suport bookmarks which are required for multi-record data controls


o codigo acima é o evento do botão de pesquisar

O Código abaixo é do botão pesquisar q fica no menu:

with DtaObjetos do
        begin
           oCn.Connected := True;
           oCn.Open;
           with qryQuery do
           begin
            Active := True;
            Close;
            SQL.Clear;
            SQL.Add(´Select * from tblaluno where matricula = -1´);
            Open;
            //ExecSQL;
           end;
           DtsGrid.DataSet := qryQuery;
           dbgAluno.DataSource := DtsGrid;
           //oCn.Close;
           //oCn.Connected := False;
           //qryQuery.Close;
           //qryQuery.Active := False;
        end;


Alguem poderia me ajudar..?!


Brenerfa

Brenerfa

Curtidas 0
POSTAR