Solved

Record Locking - Against SQL Server

Posted on 2002-04-23
6
168 Views
Last Modified: 2010-05-02
I'm using VB6 against an SQL Server 7 database.
I'm having trouble coding for a case where more than one user is accessing the same record.
If a user makes changes to the record and saves the record, the record should be saved and refreshed on the server.
The application consists of a datagrid in which the user can double-click on a record in the grid to make changes.
Then, a form is brought up to allow the user to make changes.
The way the code is written now is this:
After the user exits the form after having made changes, I run the same sql statement again to refresh and populate the grid.
But, this isn't working.
The update is only working on the machine where the user made the changes.
On other client computers accessing the grid at the same time, the changes aren't updated.

Is there some sort of commit I need to make to save all of the changes up-to-the-minute?

Thanks in Advance
John
0
Comment
Question by:jtrapat1
6 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
Comment Utility
Are you using the ADO Data Control?  If so, this might explain the problem.

Anthony
0
 
LVL 17

Expert Comment

by:inthedark
Comment Utility
There is an issue here with the way that multiple users are responsible for the same data.  What type of application is it? Could the user's responsibilities be divided?
0
 
LVL 5

Expert Comment

by:dgorin
Comment Utility
You could try a CursorType property of 2 in your ADODC or the code that opens your recordset.  If you're using ADO, anyway.
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 

Author Comment

by:jtrapat1
Comment Utility
I'm not using the ADO data control.
I'm using a recordset as a data source for the datagrid and it's still not updating for each concurrent user.

This is a client-server application.


0
 

Author Comment

by:jtrapat1
Comment Utility
I'm not using the ADO data control.
I'm using a recordset as a data source for the datagrid and it's still not updating for each concurrent user.

This is a client-server application.


0
 
LVL 1

Accepted Solution

by:
barendb earned 200 total points
Comment Utility
You need to requery all users' recordsets periodically, because they will only see data up to the last change that they have made.  Try the following, update a record on one user's machine, save changes.  Now update another record on another user's machine and save the changes, you should be getting botth changes back on the second machine, because you requery after the update.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now