Board index » delphi » connecting 2 CDSs to one provider
sasan
Delphi Developer |
sasan
Delphi Developer |
connecting 2 CDSs to one provider2005-11-20 07:16:43 PM delphi50 Hi all I am using two client datasets on my client app which are connected to one provider on the server. T contents of these CDSs are set by command text .They fetch 2 different tables on the DBMS. when I run my application I get a Record not found.... error after applying updates to these CDSs.What isthe problem and how can I solve this problem. I do not want to use two different providers for these CdSs. best regards sasan |
Bill Todd
Delphi Developer |
2005-11-20 10:01:12 PM
Re:connecting 2 CDSs to one provider
sasan writes:
QuoteI do not want to use two different Bill Todd (TeamB) |
sasan
Delphi Developer |
2005-11-21 01:49:25 AM
Re:connecting 2 CDSs to one provider
Dear todd
I have got too many tables that must opened and refreshed Once , when the program runs. They are my Definitions datasets. I want to avoid My RDM to be too much busy and confusing regards sasan "Bill Todd" <XXXX@XXXXX.COM>writes Quotesasan writes: |
Bill Todd
Delphi Developer |
2005-11-21 02:04:45 AM
Re:connecting 2 CDSs to one provider
Do you change the CommandText before you call ApplyUpdates?
-- Bill Todd (TeamB) |
sasan
Delphi Developer |
2005-11-22 12:19:35 AM
Re:connecting 2 CDSs to one provider
No, I dont change it. Basically , Is this approach good?
"Bill Todd" <XXXX@XXXXX.COM>writes QuoteDo you change the CommandText before you call ApplyUpdates? |
Bill Todd
Delphi Developer |
2005-11-22 02:36:09 AM
Re:connecting 2 CDSs to one provider
Consider the following.
You set CDS1.CommandTest to SELECT * FROM TABLE1 and open the CDS. This changes the SQL in the SQLDataSet that the DSP is connected to to SELECT * FROM TABLE1. Next you set CDS2.CommandText to SELECT * FROM TABLE2 and open the CDS. Since it is connected to the same DSP the SQL in the SQLDataSet that the DSP is connected to is changed to SELECT * FROM TABLE2. Now you call CDS1.ApplyUpdates. The SQL in the SQLDataSet that the DSP is connected to still contains SELECT * FROM TABLE2 so the DSP builds insert, update and delete statements against TABLE2 but the updated rows are from TABLE1 so some fields are not found and you get the error you received. Note that I have not tested this but based on my understanding of how DataSnap works this is what I'd expect to happen. -- Bill Todd (TeamB) |
sasan
Delphi Developer |
2005-11-22 07:58:54 PM
Re:connecting 2 CDSs to one provider
One thing that made me think of this approach is that datasnap is stateless
and my app server should not store any states in it. sasan.. "Bill Todd" <XXXX@XXXXX.COM>writes QuoteConsider the following. |