[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

DBGrid problem - Please Help

Posted on 1998-10-31
1
Medium Priority
?
150 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 20 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 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