Web Service and Client

  • Thread starter Thread starter zchrs
  • Start date Start date
Z

zchrs

Introduction (as short and concise as possible!) - My colleague and I
are new to ADO DotNet. We have as a reference the excellent Microsoft
book by David Sceppa. Dev. environment is Delphi 2006 (not very
important in this context as far as I can see). We are developing a Web
Service (WS) which returns untyped ADO DotNet datasets built from
Stored Procedures with joins from a Firebird database.

We are also developing a Windows Client for the WS. For each request
the client retrieves a dataset, pulls a table out of it and adds this
table to ONE master dataset on the client. One problem we've run into
is that its not possible to add the same table of course to a dataset.
So far we've managed to handle this by Remove table from dataset.

We've now run into a problem where our dataset comes over from WS with
tables that have DataRelations. We've tried removing DataRelations but
get a foreign key error. We haven't put any FK's on the tables (unless
building the DataRelation is what does this) so we don't understand why
this error occurs.

EX. myClientDataSet = WS.CustomerDataSet; //has table Customers
//Check if my table Customers already is in myClientDataSet if
so remove if CanRemove
//Else just add Customers to myClientDataSet

Perhaps our main problem is we are handling this scenario all wrong -
i.e. WS sending datasets, client pulling tables from the datasets and
adding all tables to one SINGULAR Client data set - we are simply not
sure. At first we used separate data sets on the client but it seems to
us the single ds is correct as we assume the idea is to emulate the db
so for example if there are contraints to enforce its all in the on
dataset?????

In that we are using joins to supply the data, we are also concerned
that our updates will be at best difficult - but I'll get back to that
question!

Thanks for any and all assistance on this
 
MY OWN PARTIAL ANSWER - Of course the datarelation creates FK's! We now
wonder though why this doesn't remove the FK's automatically

if aDataSet.Relations.Contains(aRelation) and
aDataSet.Relations.CanRemove(aDataSet.Relations.Item[aRelation])
then
aDataSet.Relations.Remove(aDataSet.Relations.Item[aRelation]);

ADDITIONALLY to initial message - the ClientDataSet is first retrieved
into a TempDataSet which is used with TempDataSet.Tables[].Copy
function to get the table to add to the ClientDataSet.
 
SOLUTION to part of our difficulties we've discovered is using the
DATASET Merge method and where we only want the last retrieved rows to
be in a a DataTable, we Clear the Table first.
 
Back
Top