View Single Post
  #2 (permalink)  
Old May 17th, 2007, 05:38 PM
dparsons dparsons is offline
Wrox Author
 
Join Date: Oct 2005
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Depends. Ideally, you will get an I/O error because there *should* be a lock on the file when userA opens the file for writing and that lock is then released when the write is finished. (You can see this effect when you open a file in code and fail to close your connection to it)

Personally, the thought of a "flat file" for data storage sends a chill up and down my spine! I like data, I like my data in a structured way with relationships so on and so forth BUT your problem is not simply solved by throwing a database behind your app.

Here is why. (Since I do not exactly what your users are doing, this is a bit of assumption)

In the event of an INSERT, you have no problem since rows are just being added to a table the problem arises if you give your users the abiltiy to UPDATE information. If userA and userB access the same set of data at the same time and they both make changes to that data independant of one another and then they each hit submit at different times...ut oh?

If userA clicks update first, the data is changed in the database to reflect their changes then userB clicks update and userA's data is overwritten. Which data is accurate? How can you be sure?

This is surely something you need to be aware of when writing back and forth to databases, albeit, your post didn't explictly say you were allowing your users to change information.

hth.

================================================== =========
Read this if you want to know how to get a correct reply for your question:
http://www.catb.org/~esr/faqs/smart-questions.html
================================================== =========
Technical Editor for: Professional Search Engine Optimization with ASP.NET
http://www.wiley.com/WileyCDA/WileyT...470131470.html
================================================== =========
Why can't Programmers, program??
http://www.codinghorror.com/blog/archives/000781.html
================================================== =========
Reply With Quote