PC Review


Reply
Thread Tools Rate Thread

Manipulating DataSets through XML

 
 
Val
Guest
Posts: n/a
 
      13th Sep 2004
Hi all,
Im trying to make a lil database server, it communicates with clients
through tcp connections.
Its pretty cool so far, but manipulating with the DataSet is messy:
There is a function which loads xml data (and schema) into the dataset but
whats the way to delete records from a dataset using xml?

So far my solution came to this:

DataSet "A" - Contains the original records
DataSet "B" - Contains same records as "A" but some have deleted

1.Create a new dataset "C" which contains deleted records using
"B.GetChanges(DataRowState.Deleted)"
2.Convert "C" into xml string and send it to the server

But ones "C" gets to server how do I delete the records in "A" using it?
I could use "foreach" on all the records in "A" and delete them if they
match records in "C", but surely theres a better way...

Thank u!
Val


 
Reply With Quote
 
 
 
 
Shock
Guest
Posts: n/a
 
      13th Sep 2004
Val wrote:

> Hi all,
> Im trying to make a lil database server, it communicates with clients
> through tcp connections.
> Its pretty cool so far, but manipulating with the DataSet is messy:
> There is a function which loads xml data (and schema) into the dataset but
> whats the way to delete records from a dataset using xml?
>
> So far my solution came to this:
>
> DataSet "A" - Contains the original records
> DataSet "B" - Contains same records as "A" but some have deleted
>
> 1.Create a new dataset "C" which contains deleted records using
> "B.GetChanges(DataRowState.Deleted)"
> 2.Convert "C" into xml string and send it to the server
>
> But ones "C" gets to server how do I delete the records in "A" using it?
> I could use "foreach" on all the records in "A" and delete them if they
> match records in "C", but surely theres a better way...
>
> Thank u!
> Val
>
>


Why not create a collection of objects (i.e. a collection of records to
be deleted) and pass that collection to the server? Then you could have
the server create an new instance of each record using an identifer from
each object (i.e. record). Then simply remove each object (i.e. record)
from the database. This would be easily implemented using a
persistence framework such as Gentle.Net
(http://www.mertner.com/confluence/homepage.action).

This is pretty much the same basic idea, only it is much more OO than
just using ADO/ADO.NET, easier to implement IMHO, and it would possibly
be much faster.

Shock
 
Reply With Quote
 
Val
Guest
Posts: n/a
 
      13th Sep 2004
Thanks Shock,
I thought it would be better to have a dataset with all the records from the
db in memory, and manipulate the records inside the dataset. Then have a
thread that synchronizes the dataset with db every once in a while.

This server will be accessed by multiple users at once, and if all of them
delete records - the server will have to clear the dataset and refill it
from db every time a record is deleted. If the table contains alot of
records this might be pretty laggy.

This whole thing is in C# btw.
I don't know maybe im just being strange here, ne way I hope someone out
there can clarify this whole thing.

Thanks again,
Val

"Shock" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Val wrote:
>
>> Hi all,
>> Im trying to make a lil database server, it communicates with clients
>> through tcp connections.
>> Its pretty cool so far, but manipulating with the DataSet is messy:
>> There is a function which loads xml data (and schema) into the dataset
>> but whats the way to delete records from a dataset using xml?
>>
>> So far my solution came to this:
>>
>> DataSet "A" - Contains the original records
>> DataSet "B" - Contains same records as "A" but some have deleted
>>
>> 1.Create a new dataset "C" which contains deleted records using
>> "B.GetChanges(DataRowState.Deleted)"
>> 2.Convert "C" into xml string and send it to the server
>>
>> But ones "C" gets to server how do I delete the records in "A" using it?
>> I could use "foreach" on all the records in "A" and delete them if they
>> match records in "C", but surely theres a better way...
>>
>> Thank u!
>> Val

>
> Why not create a collection of objects (i.e. a collection of records to be
> deleted) and pass that collection to the server? Then you could have the
> server create an new instance of each record using an identifer from each
> object (i.e. record). Then simply remove each object (i.e. record) from
> the database. This would be easily implemented using a persistence
> framework such as Gentle.Net
> (http://www.mertner.com/confluence/homepage.action).
>
> This is pretty much the same basic idea, only it is much more OO than just
> using ADO/ADO.NET, easier to implement IMHO, and it would possibly be much
> faster.
>
> Shock



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Manipulating Datasets Anil Gupte Microsoft VB .NET 9 4th Mar 2008 06:50 PM
Manipulating subsets of large datasets =?Utf-8?B?QXN0cm9maW4=?= Microsoft Excel Worksheet Functions 4 7th Mar 2007 06:11 PM
How do Datasets manage to get deserialized as DataSets instead of a wsdl.exe-created proxy class? Francisco Garcia Microsoft ASP .NET 2 13th Apr 2006 12:41 PM
How do Datasets manage to get deserialized as DataSets instead of a wsdl.exe-created proxy class? news.microsoft.com Microsoft ASP .NET 0 12th Apr 2006 11:07 AM
Converting Untyped Datasets into Strongly Typed Datasets with Foreign Key Constraints. Alex Berryhill Microsoft ADO .NET 2 19th Mar 2004 03:20 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:22 PM.