Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 07-03-2009, 01:20 PM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333
Default Show Data in DBGrid

Hi...

Much too long since I did database programming with Delphi, but now I'll have to write a small utility and I forgot...

I have:
TAdoConnection with Connection=True

I have a TMemo in which I'm typing a query. I also have a TDbGrid in which I want to show the result of the query I typed.
[sql]select * from atable[/sql]

What components do I need and how do I link them so my results get displayed?

Been trying different stuff, but no way my grid shows any data...
Reply With Quote
  #2  
Old 07-03-2009, 01:59 PM
Samuel Samuel is offline
Senior Member
 
Join Date: Feb 2006
Posts: 247
Default

Hi Norrit,

You need to Have :

Code:
    ADOConnection1: TADOConnection;
    ADOQuery1: TADOQuery;
    DataSource1: TDataSource;
    DBGrid1: TDBGrid;
...

ADOQuery1.Connection := ADOCOnnection1;
DataSource1.DataSet := ADOQuery1;
DBGrid1.DataSource := DataSource1;

ADOQuery1.SQL.Text := 'SELECT * FROM aTable';
ADOQuery1.Active := TRUE;
That's it
Sam
Reply With Quote
  #3  
Old 07-06-2009, 11:20 AM
Norrit Norrit is offline
Moderator
 
Join Date: Aug 2001
Location: Landgraaf
Posts: 7,333
Default

Thanx, that was easy indeed....
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 10:55 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.