Solved

DBGrid problem - Please Help

Posted on 1998-10-31
1
148 Views
Last Modified: 2010-04-06
I'm having trouble getting the contents of a table created at runtime to show in a DBGrid (called EstimateGrid). The table is being created and modified successfully, but not showing at all in the grid. Extract of code follows. Please help. Thanks.

DataSource2 := TDataSource.Create(self);
DataSource2.Dataset := Table;
DataSource2.Enabled :=True;
EstimateGrid.DataSource := DataSource2;
EstimateGrid.Enabled := True;
0
Comment
Question by:cavalry
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 8

Accepted Solution

by:
ZifNab earned 10 total points
ID: 1345170
Hi cavalry,

Did a little test, but everything seems to work.

You 're sure the table is active?

ps. Don't forget to free your create datasource!!!!!

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  Grids, DBGrids, Db, DBTables;

type
  TForm1 = class(TForm)
    Table1: TTable;
    DBGrid1: TDBGrid;
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
  private
    { Private declarations }
    DataSource2 : TDataSource;
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}

procedure TForm1.FormCreate(Sender: TObject);
begin
DataSource2 := TDataSource.Create(self);
DataSource2.Dataset := Table1;
DataSource2.Enabled :=True;
DBGrid1.DataSource := DataSource2;
DBGrid1.Enabled := True;
Table1.Open;  <----------- !
end;

procedure TForm1.FormDestroy(Sender: TObject);
begin
 DataSource2.Free;
end;

end.

Regards, Zif.
0

Featured Post

Industry Leaders: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question