Hi,
I’ve created an educational software application accessed by students from a
central server. On Start-Up the application reads an XML file that stores
student progress records. This XML file stores DataSet information, one
DataTable and a number of DataRows, one per student. Once finished the
student’s DataRow is updated and the DataSet is written to the XML file.
My problem is that during the time the student has worked on the application
other students will have written to the XML file, updating their progress
information. The student’s copy of the DataSet is no longer current. Writing
to the XML file will write over data entered by other students.
Is there an effective way, at Close, to reread the XML file into the App,
update the current student’s DataRow, and then immediately write back to the
XML file. Basically I am looking for a way to lock up access to the XML file
during this process. My present Load and Closing code includes:
// On Opening
DataSet ds;
{
XmlDataDocument doc = new XmlDataDocument ();
doc.DataSet.Rea dXml("convowel. xml");
ds = new DataSet("Target Letters");
ds = doc.DataSet;
}
// On Closing
private void ConVowelDialog_ Closing(object sender,
System.Componen tModel.CancelEv entArgs e)
{
StreamWriter myStreamWriter = new
StreamWriter(@" convowel.xml");
ds.WriteXml(myS treamWriter);
myStreamWriter. Close();
}
Any advice would be greatly appreciated.
Ted 2 7467
Ted,
an XML file is not a good data store in a multiuser scenario, but you
already found that out by yourself. The best advice I can give you is to not
use an XML file as a data store.
To work around this problem you'd face writing an abstraction layer that
hides the data store, and knows how to resolve conflicts based on an
optimistic locking strategy - e.g. you include a unique identifier and a
timestamp on every record, detect any update conflicts and reject the
update. Still, you can't work around the fact that you have to completely
lock the entire file while an update is in progress. This can severly impact
performance and scalability of your app.
A better solution is to store data in a data store that providers finer
grained data access, such as a database. There are plenty of cheap solutions
out there that work in low volume scenarios. The Microsoft way would be
MSDE, which is a free, scaled down version of SQL Server that works
seemlessly with the .NET Framework and SQLXML.
HTH,
Christoph Schittko
Software Architect, .NET Mentor
MS MVP XML .NET
"Ted Duross" <te*******@Roge rsNoSpam.com> wrote in message
news:e1******** ******@tk2msftn gp13.phx.gbl... Hi, I've created an educational software application accessed by students from
a central server. On Start-Up the application reads an XML file that stores student progress records. This XML file stores DataSet information, one DataTable and a number of DataRows, one per student. Once finished the student's DataRow is updated and the DataSet is written to the XML file. My problem is that during the time the student has worked on the
application other students will have written to the XML file, updating their progress information. The student's copy of the DataSet is no longer current.
Writing to the XML file will write over data entered by other students. Is there an effective way, at Close, to reread the XML file into the App, update the current student's DataRow, and then immediately write back to
the XML file. Basically I am looking for a way to lock up access to the XML
file during this process. My present Load and Closing code includes: // On Opening DataSet ds; {
XmlDataDocument doc = new XmlDataDocument ();
doc.DataSet.Rea dXml("convowel. xml"); ds = new DataSet("Target Letters");
ds = doc.DataSet;
} // On Closing
private void ConVowelDialog_ Closing(object sender, System.Componen tModel.CancelEv entArgs e)
{
StreamWriter myStreamWriter = new StreamWriter(@" convowel.xml");
ds.WriteXml(myS treamWriter);
myStreamWriter. Close();
} Any advice would be greatly appreciated. Ted
Dear Christoph,
Thank you very much for this information. I've started to read up on
MSDE and am quite excited by the options it provides (not to mention the
price).
Before this I had been considering another approach. My application
will likely be used by quite a small group at any one time, 20 to 30 max.
Actual writing to the XML file would be as the app closed. I was considering
making use of the FileStream's Lock method to block access to my XML file
while data was being updated. If another instance of the app attempted to
access the file when locked it would place itself into a repeat loop,
reattempting access every few seconds until successful.
Thanks again,
Ted
"Christoph" <ch************ *@austin.rr.com > wrote in message
news:uy******** ******@TK2MSFTN GP11.phx.gbl... Ted,
an XML file is not a good data store in a multiuser scenario, but you already found that out by yourself. The best advice I can give you is to
not use an XML file as a data store.
To work around this problem you'd face writing an abstraction layer that hides the data store, and knows how to resolve conflicts based on an optimistic locking strategy - e.g. you include a unique identifier and a timestamp on every record, detect any update conflicts and reject the update. Still, you can't work around the fact that you have to completely lock the entire file while an update is in progress. This can severly
impact performance and scalability of your app.
A better solution is to store data in a data store that providers finer grained data access, such as a database. There are plenty of cheap
solutions out there that work in low volume scenarios. The Microsoft way would be MSDE, which is a free, scaled down version of SQL Server that works seemlessly with the .NET Framework and SQLXML.
HTH, Christoph Schittko Software Architect, .NET Mentor MS MVP XML .NET "Ted Duross" <te*******@Roge rsNoSpam.com> wrote in message news:e1******** ******@tk2msftn gp13.phx.gbl... Hi, I've created an educational software application accessed by students
from a central server. On Start-Up the application reads an XML file that
stores student progress records. This XML file stores DataSet information, one DataTable and a number of DataRows, one per student. Once finished the student's DataRow is updated and the DataSet is written to the XML file. My problem is that during the time the student has worked on the application other students will have written to the XML file, updating their
progress information. The student's copy of the DataSet is no longer current. Writing to the XML file will write over data entered by other students. Is there an effective way, at Close, to reread the XML file into the
App, update the current student's DataRow, and then immediately write back to the XML file. Basically I am looking for a way to lock up access to the XML file during this process. My present Load and Closing code includes: // On Opening DataSet ds; {
XmlDataDocument doc = new XmlDataDocument ();
doc.DataSet.Rea dXml("convowel. xml"); ds = new DataSet("Target Letters");
ds = doc.DataSet;
} // On Closing
private void ConVowelDialog_ Closing(object sender, System.Componen tModel.CancelEv entArgs e)
{
StreamWriter myStreamWriter = new StreamWriter(@" convowel.xml");
ds.WriteXml(myS treamWriter);
myStreamWriter. Close();
} Any advice would be greatly appreciated. Ted
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: CJM |
last post by:
I'm setting up some web-based (ASP) reports that query an Access DB. I also
want certain people to be able to access and manipulate the database
directly.
However, if the database is open in Access, I cant access it via ASP:
Microsoft JET Database Engine error '80004005'
Could not use ''; file already in use.
|
by: Durai |
last post by:
Hi All,
I tested "concurrent testing" in MySQL. It works fine. But I couldn't do in PostgreSQL 7.3.4 on HPUX IPF. I got deadlock problem. I used the PHP script to update table( one script increment the column & another one decrement the column). Is the postgres support the concurrent access to update database?
I got the following errors:
test=# ERROR: deadlock detected
ERROR: deadlock detected
ERROR: deadlock detected
.....
|
by: bluedolphin |
last post by:
There seems to be a consensus that Access has a concurrent user limit
of 200 users. I am working on a system that currently stands at
approx. 1 gig and has a small number of users. However, there is a
project on the horizon that I have been asked to implement (within 2
months) where there will potentially be 1200 users accessing the
backend through a Cold Fusion Interface.
Whenever, I have been looking at this many users, I have always...
|
by: mgPA |
last post by:
Short: How can I limit the number of concurrent logins to Access
(2000) DB?
Long: I seem to be having the problem discussed in previous postings
of having more than 9 or 10 concurrent logins. If I can limit the
number of concurrent logins to 8 or 9, that would satisfy our needs.
Thanks
|
by: trond |
last post by:
Hello all,
Before I start I'd like to point out that I am a complete novice when
it comes to asp.net - My background is in network and operating
systems, and although I have been doing a bit of hobby programming in
vb.net and web programming in asp/vbscript in the past, I am pretty
much a beginner at asp.net.
What I'm trying to do, is to take the "PersonalHomePage" starter kit
that MS supplies with VS2005 and tweak it a bit, to make it...
| |
by: sethwai |
last post by:
Hi,
I've read everything I can get my hands on and am still very
confused about the similarities and differences between
db2_mmap_read/write and concurrent i/o. It seems to me at this point
that they are virtually identical except that db2_mmap_read/write
applies at an instance level and concurrent i/o can be aplied at a
tablespace level. It seems that they both bypass the AIX file cache
and eliminate i-node locking. Is this correct?
|
by: roblugt |
last post by:
I have what I imagine is a well-known .Net networking problem, but even
though I've Googled for some time I've not yet come across a thread
where this has been fully explained...
There is a fairly common idiom (at least in the Java/UNIX/Win32 worlds)
where a socket connection is established and the program then utilises
two threads: one dedicated to reading from the socket and the other one
concurrently writing to the socket - both using...
|
by: goraya |
last post by:
This is design level discussion about web applications. How I design
application that support 1 million concurrent requests??
|
by: amitpatel66 |
last post by:
There is always a requirement that in Oracle Applications, the Concurrent Program need to be execute programatically based on certain conditions/validations:
Concurrent programs can be executed programatically either from UNIX or Oracle PLSQL. In this Section, I will be explaining about calling a Concurrent program from UNIX using the CONCSUB Command.
Pre-requisite:
1. Concurrent Program should be registered in oracle Applications...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
| |
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |