Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create & join a dataset in memory with another dataset

Status
Not open for further replies.

tsb5270

Programmer
Jan 13, 2003
7
US
I want to perform a join between two datasets, which by iteself isn't so hard. Unfortunately, I need to build one of the datasets on the fly and preferably in memory. I need to read a series of key values from an external binary file, join them with a table, and return a dataset where the binary file key values = table key values. Currently I'm reading the binary file one record at a time and performing a join with the table each time. So, for 865 records I'm executing the query 865 times. I'd like to put the keys into a table in memory (maybe a clientdata set?) and then just execute a single query. Does that sound possible?
 
I can only think of 2 ways of doing this:

1. Depending on the sizes of the datasets, read both into memory, ie, binary file data and the DB Table's data and do your own search algorithms on them.

2. If one of the datasets is exceptionally large then create a temporary table and put the binary file's data in that then do the join query.

There's probably a better solution I don't know about. I'm interested to hear other peoples' responses.

lou
 
So how do I create a dataset in memory? I've tried using the ClientDataSet with no success. When I get to the part where I want to iterate through the binary and insert the value into the dataset, the application stalls and eventually blows up. I've followed examples for using ClientDataSets, but they usually are reading from some other external file (xml). I want to insert a record each time I read a record from the binary. I'm beginning to think I either don't understand the ClientDataSet well enough or the way i want to use it is inappropriate.
 
hi

I was thinking more of storing the data in records then adding to a TList.

In answer to your last question, I don't know if you can dynamically create a dataset yourself, never done it, sorry.

lou
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top