Click here to Skip to main content
15,895,423 members
Home / Discussions / C#
   

C#

 
GeneralRe: What is wrong in this code? Pin
Skippums10-Sep-07 4:43
Skippums10-Sep-07 4:43 
GeneralRe: What is wrong in this code? Pin
andredani10-Sep-07 12:21
andredani10-Sep-07 12:21 
GeneralRe: What is wrong in this code? Pin
Skippums10-Sep-07 12:23
Skippums10-Sep-07 12:23 
GeneralRe: What is wrong in this code? Pin
andredani10-Sep-07 12:27
andredani10-Sep-07 12:27 
GeneralRe: What is wrong in this code? Pin
Skippums10-Sep-07 13:17
Skippums10-Sep-07 13:17 
QuestionHelp regarding datagridview control Pin
anu817-Sep-07 19:57
anu817-Sep-07 19:57 
QuestionApplication + Remoting +Terminal Server Issue. Help Pin
fearless stallion7-Sep-07 18:27
fearless stallion7-Sep-07 18:27 
AnswerRe: Application + Remoting +Terminal Server Issue. Help Pin
Dave Kreskowiak8-Sep-07 3:18
mveDave Kreskowiak8-Sep-07 3:18 
fearless stallion wrote:
I thought of using remoting. A windows service on the DB server will have the "users + forms opened" list. As the user logs in and tries to open a form, my application will connect to service and check for, if that form is already opened by some one else. if true, then it will open form in a lock mode. But the problem is, if some one opens the form in lock mode and then the form should be notified once it is unlocked. How should i implement this? I read few articles on Remoting and invoking events but everybody says that it is not a suitable way. What can be other ways please suggest ?


Your problem isn't going to be handled by "locking forms". That just complicates things beyond what is necessary. This issue is data concurrency. As your application stands now, every user can open look at anyn data they want and modify it, all at the same time. The problem comes when the users start writing that data back to the database. Right now, your app can only do "last write wins". The last write back to the database overwrite any changes made by anyone else. It someone else is looking at the same data, they will NOT get notified of the change.

This is normally solved by adding a timestamp field to each table in the database that's shared by multiple users. In the SQL code that writes the changes back to the database, each row's primary key is used in the SQL's WHERE clause to locate the record to update, but you also include the date/time that was read from the database in the WHERE clause. If the date/time is different than the one you got, the record will not be found, meaning someone else has updated the database while you were looking at the data. What you do in that situation is up to you.

Try reading this[^] and this[^] and this[^] and a few articles from this list[^].

Basically, you've got a HUGE problem to fix, but no time to do it. I think it's time to tell management to face reality, because you're going to need more time to redesign your applications data layer. I'd tell them after you read this stuff and show them a plan of attack on the problem, 'cause there is no "quick fix" for this.






A guide to posting questions on CodeProject[^]

Dave Kreskowiak
Microsoft MVP
Visual Developer - Visual Basic
     2006, 2007


GeneralRe: Application + Remoting +Terminal Server Issue. Help Pin
fearless stallion8-Sep-07 18:05
fearless stallion8-Sep-07 18:05 
Questiontextbox & tab page bugg? Pin
rbuchana7-Sep-07 18:01
rbuchana7-Sep-07 18:01 
AnswerRe: textbox & tab page bugg? Pin
rohitsrivastava7-Sep-07 19:42
rohitsrivastava7-Sep-07 19:42 
GeneralRe: textbox & tab page bugg? Pin
rbuchana8-Sep-07 4:39
rbuchana8-Sep-07 4:39 
Questioncollection editors & component/control designers [modified] Pin
urbane.tiger7-Sep-07 17:31
urbane.tiger7-Sep-07 17:31 
QuestionHttpWebRequest performance and keep-alive Pin
pattyweb7-Sep-07 13:47
pattyweb7-Sep-07 13:47 
AnswerRe: HttpWebRequest performance and keep-alive Pin
Scott Dorman7-Sep-07 13:54
professionalScott Dorman7-Sep-07 13:54 
QuestionNeed help with panels and forms? Pin
DogMa3x7-Sep-07 12:28
DogMa3x7-Sep-07 12:28 
AnswerRe: Need help with panels and forms? Pin
Skippums10-Sep-07 3:52
Skippums10-Sep-07 3:52 
QuestionRichTextBox DragDrop [modified] Pin
Skippums7-Sep-07 11:37
Skippums7-Sep-07 11:37 
AnswerRe: RichTextBox DragDrop Pin
Dave Kreskowiak7-Sep-07 13:04
mveDave Kreskowiak7-Sep-07 13:04 
QuestionRichTextBox DragDrop Pin
Skippums10-Sep-07 3:40
Skippums10-Sep-07 3:40 
QuestionOverriding ReadOnlyCollection and "Late Population" of the list Pin
J.G.Cda7-Sep-07 11:06
J.G.Cda7-Sep-07 11:06 
QuestionHierarchical hyperlink hype Pin
Istvan4047-Sep-07 10:55
Istvan4047-Sep-07 10:55 
QuestionData Grid View Calculations Pin
jasper0187-Sep-07 10:54
jasper0187-Sep-07 10:54 
AnswerRe: Data Grid View Calculations Pin
Giorgi Dalakishvili7-Sep-07 11:06
mentorGiorgi Dalakishvili7-Sep-07 11:06 
GeneralRe: Data Grid View Calculations Pin
jasper01810-Sep-07 7:20
jasper01810-Sep-07 7:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.