Record Locking - Against SQL Server

Posted on 2002-04-23
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
Question by:jtrapat1
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 75

Expert Comment

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

LVL 17

Expert Comment

ID: 6964210
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?

Expert Comment

ID: 6964308
You could try a CursorType property of 2 in your ADODC or the code that opens your recordset.  If you're using ADO, anyway.
Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.


Author Comment

ID: 6965649
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.


Author Comment

ID: 6965688
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.


Accepted Solution

barendb earned 200 total points
ID: 6971331
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.

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

724 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