Board index » delphi » Copying cells from a TStringGrid to TDBGrid

Copying cells from a TStringGrid to TDBGrid

I'm new, so it seems like this should be easy enough, but...
I have a tab delimited file that contains varying fields and rows(e.g.
********************************************
{1st row}Account Number-Name-Amount-Date
{2d row}12332-Smith, Bob-10.50-01/01/1998
{3d row}The following information is provided by
{4th row}A Total Amount is 15
{5th row}~~5-310
******************************************
Obviously the file is much larger and the hyphens above represent the
tab delimiters, but you get the gist.  I have to manipulate and add to
the above file, create some reports in wordperfect and then insert the
data into a database.  I've got the information into the form I want it
by using string lists and a string grid, but what would be the best way
to get this into a database? If I can copy it into a DBgrid, I'd think
that would be easiest, but I don't know.  Any thoughts?  Thanks.
PS - I've never posted before either, so if this shows up twice, my
apologies.

Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.

 

Re:Copying cells from a TStringGrid to TDBGrid


You would probably need a program that loops through the rows in the
stringgrid and uses a query to insert each and every row.
This is quite fast if the query is prepared once (before the loop), and you
use explicit transaction control (StartTransaction - loop - Commit).

Aage J.

Quote
barnet...@my-deja.com wrote:
> I'm new, so it seems like this should be easy enough, but...
> I have a tab delimited file that contains varying fields and rows(e.g.
> ********************************************
> {1st row}Account Number-Name-Amount-Date
> {2d row}12332-Smith, Bob-10.50-01/01/1998
> {3d row}The following information is provided by
> {4th row}A Total Amount is 15
> {5th row}~~5-310
> ******************************************
> Obviously the file is much larger and the hyphens above represent the
> tab delimiters, but you get the gist.  I have to manipulate and add to
> the above file, create some reports in wordperfect and then insert the
> data into a database.  I've got the information into the form I want it
> by using string lists and a string grid, but what would be the best way
> to get this into a database? If I can copy it into a DBgrid, I'd think
> that would be easiest, but I don't know.  Any thoughts?  Thanks.
> PS - I've never posted before either, so if this shows up twice, my
> apologies.

> Sent via Deja.com http://www.deja.com/
> Share what you know. Learn what you don't.

Other Threads