Board index » delphi » To extract name of the Table and CommadText for a ClientDataset?

To extract name of the Table and CommadText for a ClientDataset?


2004-07-22 04:57:12 AM
delphi270
To extract name of the Table and CommadText for a ClientDataset?
I use the trio TSQLDataset + TDataSetProvider + TClientDataset.
Example:
...
var
TableName,SQL: String;
begin
TableName := ClientDataset.... ???
SQL := ClientDataSet.commandText. ->>Not of the: (???
end;
....
Some Help?
Firebird 1.5.1
 
 

Re:To extract name of the Table and CommadText for a ClientDataset?

That sadness. : (
"Bill Todd (TeamB)" <XXXX@XXXXX.COM>escreveu na mensagem
Quote
You need to get the SQL select statement from the SQLDataSet and parse
that to find the table name. The CDS does not know (or care) where the
data came from.

--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
 

Re:To extract name of the Table and CommadText for a ClientDataset?

But makes alot of sense, if you're joining 4 tables, which one is *the*
table?
For a 'live' dataset, well, usually at least, you're going with one main
table..
It just validates the idea of using consistency in SQL formatting within
your own application, to make it easier to write functions that help you do
that..
We always use the same formatting:
SELECT
FieldsList
FROM
TableList, JoinList
WHERE
Blahblah
ORDER BY
Etc..
Then we have functions we've written that all are based on a SQL Parser..
We pass the Query and 4 StringLists to this function, which parses out and
populates each StringList with the appropriate section, and also builds a
custom little set [ ssSelect, ssFrom, ssWhere, ssOrderBy ] that it returns..
You then can pass this on to other functions like SqlAddOrderBy, or
SqlAddReplaceWhereClause, etc..
Rob
 

Re:To extract name of the Table and CommadText for a ClientDataset?

You could always build your own component and just one an extra published
property to hold the table name. Then set it at design time.
"cHaPlinux? <XXXX@XXXXX.COM>writes
Quote
That sadness. : (


"Bill Todd (TeamB)" <XXXX@XXXXX.COM>escreveu na mensagem
news:XXXX@XXXXX.COM...
>You need to get the SQL select statement from the SQLDataSet and parse
>that to find the table name. The CDS does not know (or care) where the
>data came from.
>
>--
>Bill (TeamB)
>(TeamB cannot respond to questions received via email)