Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 8 of 8 total
Thread Grid Does Not Show Records
Mon, Sep 23 2013 4:51 AMPermanent Link

Frederick Chin

I am connecting to a MySql database and have created the dataset (dtsClass) for a table within the database. The Preview shows two records.

The dataset has two columns and the grid's columns point to the dataset's two columns.

When creating the form at runtime and in the OnShow event, I call Database.Load(dtsClass). The grid shows two blank records but nothing within the columns. (see attached)

What am I doing wrong?

Frederick



Attachments: norecordsingrid.png
Mon, Sep 23 2013 5:04 AMPermanent Link

Chris Holland

SEC Solutions Ltd.

Avatar

Team Elevate Team Elevate

Try creating functions for the "AfterLoad" and "OnLoadError" for your
Dataset to be sure that the data is loading correctly.

Chris Holland
[Team Elevate]

On 23/09/2013 09:51, Frederick Chin wrote:
> I am connecting to a MySql database and have created the dataset (dtsClass) for a table within the database. The Preview shows two records.
>
> The dataset has two columns and the grid's columns point to the dataset's two columns.
>
> When creating the form at runtime and in the OnShow event, I call Database.Load(dtsClass). The grid shows two blank records but nothing within the columns. (see attached)
>
> What am I doing wrong?
>
> Frederick
>
Mon, Sep 23 2013 10:56 AMPermanent Link

Frederick Chin

Chris Holland wrote:

/*
Try creating functions for the "AfterLoad" and "OnLoadError" for your
Dataset to be sure that the data is loading correctly.
*/

I added a ShowMessage() in both the events and the AfterLoad event fired.

Frederick
Mon, Sep 23 2013 1:46 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< I am connecting to a MySql database and have created the dataset
(dtsClass) for a table within the database. The Preview shows two records.

The dataset has two columns and the grid's columns point to the dataset's
two columns.

When creating the form at runtime and in the OnShow event, I call
Database.Load(dtsClass). The grid shows two blank records but nothing within
the columns. (see attached) >>

This usually indicates that the grid or dataset columns are incorrectly
defined.  Can you send me the project along with the database ?

Thanks,

Tim Young
Elevate Software
www.elevatesoft.com
Mon, Sep 23 2013 9:56 PMPermanent Link

Frederick Chin

"Tim Young [Elevate Software]" wrote:

/*
This usually indicates that the grid or dataset columns are incorrectly
defined.  Can you send me the project along with the database ?
*/

Please find file attached. Database as SQL source is within ZIP file.

Thanks.

Frederick



Attachments: testdb.zip
Mon, Sep 30 2013 9:05 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< Please find file attached. Database as SQL source is within ZIP file. >>

Thanks.

You have the fields defined in your dtsClass dataset with a "co" prefix that
isn't actually in the source MySQL table.  Just fix the column names in the
Object Inspector for both the TDataSet and the TGrid and you'll be all set.

If you have any other questions, please let me know.

Tim Young
Elevate Software
www.elevatesoft.com


Tue, Oct 1 2013 11:04 PMPermanent Link

Frederick Chin

Tim,

/*
You have the fields defined in your dtsClass dataset with a "co" prefix that
isn't actually in the source MySQL table.  Just fix the column names in the
Object Inspector for both the TDataSet and the TGrid and you'll be all set.
*/

Thanks. The changes solved the problem.

I was confused with the dtsClass's column editor's properties because I would have expected each column to have a Name and a DataBinding (if you will) property. The Name would be coCode while DataBinding would be Code from the MySQL table.

In the grid, the DataColumn property would point to coCode.

Frederick

Tue, Oct 8 2013 3:21 PMPermanent Link

Tim Young [Elevate Software]

Elevate Software, Inc.

Avatar

Email timyoung@elevatesoft.com

Frederick,

<< I was confused with the dtsClass's column editor's properties because I
would have expected each column to have a Name and a DataBinding (if you
will) property. The Name would be coCode while DataBinding would be Code
from the MySQL table. >>

You're thinking of persistent TFields in Delphi, which is not exactly what
EWB is doing.  What EWB is doing is more akin to TFieldDefs combined with
some additional functionality from the TFields.

Tim Young
Elevate Software
www.elevatesoft.com


Image