Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Table locking

Status
Not open for further replies.

PT5SS

Programmer
Oct 6, 2000
5
US
We have client/server application using SQL Server7 and VB. We want to lock the table that is used during the connection as data integrity is a must. What is the best solution for this ?? [sig][/sig]
 
There isn't an explicit LOCK TABLE command. If you could give us a little more background, we might be able to offer a solution that is best for what you are trying to do.

Without more info, SET TRANSACTION ISOLATION LEVEL SERIALIZABLE is the most stringent and exclusive of the isolation levels that you could use within a transaction. [sig]<p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br> [/sig]
 
The VB program establishes a one time connection to SQL when a user logs in. We want to lock a certain table when the user enters a individual form until all processing is done.

The problems we are having are that more that one query can be run within this form once they are in it. At the end of the processing the user saves what is on the screen BUT if anothe user updated the table (expecially a next transferNumber field) the integrity of the data would be lost.

Our ideas have been to look into SET TRANSACTION ISOLATION LEVEL SERIALIZABLE or Revoke privilages to that table for all other users.

If you have any sugesstions or tips on SET TRANSACTION they would be appreciated. Thanks for the help already. [sig][/sig]
 
tread carefully...locking whole tables will turn your lovely multi-user client/server system into a single-user system. Things to consider could be:

1. let the server allocate 'next ids' when data is sent to it.

2. timestamp records and compare with updates to make sure that someone else hasn't updated that record while you had it on screen. [sig]<p> <br><a href=mailto: > </a><br><a href= home</a><br> [/sig]
 
Depends how large the table is. You could select * from the table for update (I think this is in SQL Server). In VB their are options on the cursor for locking type. You can have read locking on the record which will stop another user from updating the record. I would suggest investigating read level locking on the table rather than table level [sig]<p>Cal<br><a href=mailto: > </a><br><a href= > </a><br> [/sig]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top