Page 1 of 1

Inserting Data Into DBGrid

Posted: Tue Dec 12, 2006 6:23 am
by 9347662
Hi,
I am using Borland Delphi 2005 and was wondering how I can input calculated values from TeeChart into a DBGrid with an excel worksheet loaded on it? Basically I have a template with titles and blanks for the values to be inputed. I load it onto the DBGrid and I want to load some values I calculated from the Graphed TeeChart into the selected blanks and save it. Please help. Thanks in advance.
David

Posted: Mon Dec 18, 2006 3:39 pm
by Pep
Hi David,

I'm not sure if I understand what you are trying to do. If you jus want to add data into a standard TDBGrid component you will have to use the available methods of TDBGrid component to put data into a selected cell, which most likely can be found in the Delphi help.

Posted: Tue Dec 19, 2006 5:41 am
by 9347662
Hi,
I have tried the help through Borland Delphi and found it pretty useless. All I want to do is insert some data, any number values, into the DBGrid. What I have done so far is I have been able to load a template of Excel with titles in it into the DBGrid in Delphi. What I am trying to do now is get the values in Delphi to load into DBGrid. How do I do that? Or simply, how do I put values into DBGrid automatically? Thank you.
David

Posted: Tue Dec 19, 2006 7:36 am
by Marjan
Hi.

Why don't you simply create a temporary table, copy values in it and finally connect this table directly to TDBGrid using the same schema as for any other dataset ?

Posted: Tue Dec 19, 2006 11:12 pm
by 9347662
Hi,

I am not sure what you mean. I take it you are saying to create another table, insert the values in it then connect the two tables? If so, that is the problem. I am trying to insert some numbers which are calculated through Delphi into the DBGrid. I want this to be done automatically, not copy random values into the Grid. I do not know how to do that. I am quite new to DBGrid and do not understand much concept. Please help. Thank you.

Posted: Thu Dec 21, 2006 11:52 am
by Marjan
Hi.
take it you are saying to create another table, insert the values in it then
Yes, and then connect it to TDBGrid. Or if you want a more generic solution, create a customized datasource for table and then connect the table it.
I want this to be done automatically
Still, you can calculate values, pass them to table and Delphi will do the rest (format and display them in TDBGrid).

Alternatively, if you only want to display some calculated values in grid, don't use TDBGrid, but rather use TStringGrid to display your calculations.