• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Refresh a dbgrid

The codes are like as:

>   Query1->Close();
>   Query1->SQL->Clear();
>   Query1->SQL->Add("insert into supply(suppno,suppname)\
>                     values ('255222','11xx')");
>   Query1->Close();
>   Query1->SQL->Clear();
>   Query1->SQL->Add("select * from supply");
>   Query1->Prepare();
>   Query1->Active = true;

But the dbgrid of the table was nort refreshed.
Need any suggestion. Thank you.
0
mathematics
Asked:
mathematics
1 Solution
 
extremeCommented:
I suppose you have a TTable connected with that DBGrid. In fact, if you modify the Query, that don't modify the table. If you want to have the results of the query in a DBGrid, then you have to connect the DBGrid with a DataSource connected to the query.
0
 
bijoynCommented:
Hi ,

I noticed that in the above code that u have specified. U are not doing a Query1.ExecSQL to add the inserted record. Have u forgotten to do it or have u just slipped while typing the code ?????. Do a Query1.ExecSQL to solve the problem

Cheers,

Bijoy
0
 
mathematicsAuthor Commented:
Thank Bijoy,I got it.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now