Board index » delphi » connecting 2 CDSs to one provider

connecting 2 CDSs to one provider


2005-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
 
 

Re:connecting 2 CDSs to one provider

sasan writes:
Quote
I do not want to use two different
providers for these CdSs.
Why not?
--
Bill Todd (TeamB)
 

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
Quote
sasan writes:

>I do not want to use two different
>providers for these CdSs.

Why not?

--
Bill Todd (TeamB)

 

Re:connecting 2 CDSs to one provider

Do you change the CommandText before you call ApplyUpdates?
--
Bill Todd (TeamB)
 

Re:connecting 2 CDSs to one provider

No, I dont change it. Basically , Is this approach good?
"Bill Todd" <XXXX@XXXXX.COM>writes
Quote
Do you change the CommandText before you call ApplyUpdates?

--
Bill Todd (TeamB)
 

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)
 

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
Quote
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)