?
Solved

DBGrid problem - Please Help

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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

741 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