HighTechTalks DotNet Forums  

Data access from a web server

Dotnet XML microsoft.public.dotnet.xml


Discuss Data access from a web server in the Dotnet XML forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
James
 
Posts: n/a

Default Data access from a web server - 04-07-2004 , 09:41 PM






All data for my company is stored on an internet web server, hosted by discountasp.net, and a web service is used for both Windows and web clients to retreive and modify it. I'm using a Microsoft Access .mdb file. A local server is not used because, although only a small business, not all employees work from a single location (some in London, others in Delhi, etc.). The trouble is that it's not particularly easy to work with the data in 'real-time'. Since several people may be modifying the same tables at once and the latest version of everything is always required, all SELECT, UPDATE, INSERT and DELETE commands are directed at the online database, through the web service. Everything works, but it's quite slow, and the constant transmission of information (even whole tables, sometimes) is eating up bandwidth

I considered using an offline database for all local operations, which can be synchronised when required, but have no idea how to do this. I'm really only a beginner, and the only thing I can think to do would be to send the whole offline database in a dataset with an UPDATE command. But that's still killing my bandwidth, isn't it

Anyway, how do updates work (I'm using C# with the .NET framework 1.1). If I update a database with a modified DataSet
does the new dataset completely replace the old data? Because that would be useless. If other users had made other changes to the tables before the synchronisation, would they be erased when I synchronise

Basically, does anyone have any ideas how I can resolve this situation (please don't say buy more bandwidth!)?

Reply With Quote
  #2  
Old   
AT
 
Posts: n/a

Default RE: Data access from a web server - 04-08-2004 , 05:51 AM






Hi James,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know how does ADO.NET work
when updating using a DataAdapter, and how to make update faster. If there
is any misunderstanding, please feel free to let me know.

In a DataTable, each DataRow object has a property named "RowState". It is
an enumeration value, which can be the following enumerations: Added,
Deleted, Modified, Unchanged. When DataAdapter.Update is called, the method
iterates through the row collection. It calls DataAdapter.InsertCommand on
Added rows, DeleteCommand on Deleted rows, UpdateCommand on Modified rows
and ignore the Unchanged rows. If Refresh data option is checked in
DataAdapter wizard or you have added a SELECT statement in the
InsertCommand, the inserted row will also be refreshed by the value
actually inserted into the database.

It will be very slow if we update the whole DataSet in a Web Service,
because we need to send all the rows to the server. However, the Unchanged
rows are just ignored. We can use DataSet.GetChanges method to get all the
rows whose RowState values are Added, Deleted or Modified. When updating,
we just pass the diffgram to server side and merge it back to the original
DataSet after updating. This saves much bandwidth.

Here are 2 KB articles about how to update server data through a web
service by using ADO.NET.

http://support.microsoft.com/default.aspx?scid=310143
http://support.microsoft.com/default.aspx?scid=313540

If the data in database has been changed after filling to the DataSet and
before updating, the DataAdapter will be aware of it and an
DBConcurrencyException will be thrown. Here is an article about how to
handle concurrency errors.

http://msdn.microsoft.com/library/de...us/vbcon/html/
vbwlkhandlingconcurrencyexception.asp

HTH. If anything is unclear, please feel free to reply to the post.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.