Board index » delphi » Problems using SQLServer + DevExpress DBGrids and TQuery

Problems using SQLServer + DevExpress DBGrids and TQuery

Hi, I have a form that is using a Developer Express DBGrid + TQuery on the
SQLServer..
If I write the SQL command inside the TQuery and activate the query it
brings me the values on the grid,
but if a write the same SQL command on the fly it doesnt bring anything..
When I check the record count
it show the number of records correctly..

   qryGroupList.Close;
   qryGroupList.SQL.Clear;
   qryGroupList.SQL.Text := ' Select * from groups';
   qryGroupList.ExecSQL;
   qryGroupList.Active := True;

Does somebody knows what is wrong?

Thanks a lot!
[]s
Marcelo

 

Re:Problems using SQLServer + DevExpress DBGrids and TQuery


Quote
"Marcelo Ramos" <mra...@caisoftdesign.ca> wrote in message

news:3d2dd033$1_2@dnews...

Quote
> Hi, I have a form that is using a Developer Express DBGrid + TQuery on the
> SQLServer..
> If I write the SQL command inside the TQuery and activate the query it
> brings me the values on the grid,
> but if a write the same SQL command on the fly it doesnt bring anything..
> When I check the record count
> it show the number of records correctly..

>    qryGroupList.Close;
>    qryGroupList.SQL.Clear;
>    qryGroupList.SQL.Text := ' Select * from groups';
>    qryGroupList.ExecSQL;
>    qryGroupList.Active := True;

Remove this line:

Quote
>    qryGroupList.ExecSQL;

This line is only used if you are executing uptdae/insert/delete statements.
You only need to set Active to true or call Open.

--
Wayne Niddery (Logic Fundamentals, Inc.)
RADBooks: http://www.logicfundamentals.com/RADBooks/delphibooks.html
Those who disdain wealth as a worthy goal for an individual or a society
seem not to realize that wealth is the only thing that can prevent
poverty. - Thomas Sowell

Other Threads