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!

TClientDataSet: Assing Local Data at run-time 1

Status
Not open for further replies.

MagicFrisbee

Programmer
Feb 22, 2006
74
US
At design-time, TClientDataSet can be right-clicked to select the Assign Local Data... command, which populates it with rows from another dataset. I have not been able to find the equivalent run-time procedure that does the same thing. Note that I am not trying to CLONE a dataset or a cursor; I just want a complete, read-only copy of the source data, which in this case is a TTable.

GIS Programmer
City of Orem, UT
 
The TTable isn't connected to a dBase or Paradox table, but one on an enterprise server. Therefore, I can't specify a file name to load from.

GIS Programmer
City of Orem, UT
 
OK. I thought the Load Local Data equivalent might be somehow faster that iterating till EOF and copying records. I thought that it took, like, huge batches of memory and plopped 'em into the TClientDataSet's Data property or something. Oh, well.

GIS Programmer
City of Orem, UT
 
To have a complete record for record copy of the source TTable data, can you not use a TQuery using an SQL statement like "SELECT * FROM..." against the TTable source of data? For example, if the data exposed by your TTable is called my_table, can you not use a TQuery to execute the following query: "SELECT * FROM my_table"? This can and will provide a read-only copy of the TTable data at run-time.

Steve.
 
@smays - Yeah, I can, but here's the behind-the-scenes info: I have a TDBLookupCombo descendant. It's connected to a field that represents a foreign key (an integer). There's another large table that has the IDs as a primary key, and a string value in another field. The TDBLookupCombo uses the foreign key and primary key together to show the user the resulting string value. That's all fine and good, but the resulting drop-down box doesn't have the strings in alphabetical order--it has them in ID order. So, I used a TClientDataSet and defined two indexes on it (one by ID, the other by the string field) and now it works fine. The application takes a little longer to bring up, though, because I copy all the records on FormCreate.

GIS Programmer
City of Orem, UT
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top