As a suggestion: Always perform your filtering and sorting on the client
dataset object (see the documentation for the DataView object) and fill your
dataset object from the complete set of rows needed when you are online.
That way you can have identical business logic and UI code. You do not want
to change your application code to have different ways of sorting and
filtering when the application is online or offline (that would suck!)

Obviously this simple strategy would not be very good if you were dealing
with large datasets that could take hours to download. There are a myriad of
other strategies that you could use in these circumstances such as
replicating the tables to a local MSDE data store or persisting SQL data as
XML when online but always loading the datasets from the persisted xml
regardless of the offline/online state of the application.

As a guiding principal in your quest: Regardless of where the data comes
from (online or offline), the business logic and the UI logic should remain
the same. Don't try to change your SQL to match the application state.
Decouple the activities of synchronizing the local xml data storage from the
activity of using the data in the application.

--Paul Mehner


-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Julia Lerman
Sent: Wednesday, July 06, 2005 8:25 AM
To: [email protected]
Subject: SPAM-LOW: Re: [ADVANCED-DOTNET] ADO.Net

Jon-
this is a common misconception with people newly working with disconnected
data. SELECT is for querying against databases (such as SQL Server). Once
you have a data in your ADO.NET objects (eg DataSet, DataTable) you can do
things like filter and sort with a DataView, join tables with a
DataRelation, etc. I'm sure if you have a basic book on ADO.NET it will help
you with these things. But querying is not an option.

There is a whole series of things you can do within XML with xpath query but
I know very little about that.

Julie Lerman

-----Original Message-----
From: Unmoderated discussion of advanced .NET topics.
[mailto:[EMAIL PROTECTED] On Behalf Of Jon Rothlander
Sent: Wednesday, July 06, 2005 11:52 AM
To: [email protected]
Subject: [ADVANCED-DOTNET] ADO.Net

I've doing what I would think would be a very common use of ADO.Net, but I
cannot find much info on this in any of my book or online.  What I'm doing
seems pretty simple.

I have an app that can run in both a disconnted and connected state.  When
it is disconnected, it is disconnected from the SQL DB.  My client machine
does not have access to a local database, so I am using XML on the client.
I am loading the XML into datasets to be processed.

The problem I'm running into is that I cannot easily perform the same SELECT
statements against the datasets that I can perform against SQL Server.  For
example, lets say that I have the following SQL SELECT statement...

SELECT * FROM table1

If I bring a copy of table1 from SQL server to the client machine and save
it as XML, I can reload the dataset using the local copy of XML.  Reload the
XML will recreate the same dataset as the SQL SELECT statement created with
I was connected to the Server.

However, take the following SQL statement..

SELECT ID, rtrim(ltrim(FirstName + ' ' + LastName, FROM table1 WHERE userid
= '1' OR userid = NULL

What options do I have in loading table1 into a dataset and them recreating
this same SQL statement?  What if the SQL statement was even more complex
with 3 or 4 tables, a few JOINS, etc?  Do I have to build the dataset tables
individually, then set up relationships, and them perform simple SQL
statements one at a time while creating new datasets with each result?

That seems to be the way the books show you.  However, that seems to be a
major pain.  I might as well right XML parsing code to handle it.  Maybe
creating a new dataset from SQL when the user is last connected, but create
one with the JOINS already in place.  Then just use multiple table().Select
() statements to drill into the records I need.

What do you think is the best way to handle this sort of logic?

Any ideas would be very much appreicated.  I want to make sure I approach
this one correctly so I do not need to rewrite it down the road.  I  also
want to understand what options I have to make sure I am not missing
something that would make this pretty easy to code.

Best regards,
Jon

===================================
This list is hosted by DevelopMentorR  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentor.  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to