473,320 Members | 1,832 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Lock record

HDI
Hi,
I'm writing a windows application where users can update records but
how can I lock a record when a user opens it.

With ado and vb6 you can lock the opened record but with ado.net I
don't know how to do this.

I am using vb.net and SQL Server.
thx.

Jan 18 '07 #1
3 2508
I agree, I've seen cases where a record was locked when it was opened. The
person going out to lunch, leaving it locked and others who needed access to
it being unable to get it until he/she came back and released the lock.
Not a good idea unless you realy think through and handle all the
unexpected problem scenarios, which is a lot of work.

Regards,
Bob
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:EC**********************************@microsof t.com...
HDI,

The disconnected architecture of ado.net encourages optimistic locking to
deal with concurrency issues. This is the approach used by most of the
ado.net code that I have encountered.

You can still make pessimistic locking work, but unless you have a really,
really good reason to do so, you should first consider using optimistic
locking.

Kerry Moorman
"HDI" wrote:
>Hi,
I'm writing a windows application where users can update records but
how can I lock a record when a user opens it.

With ado and vb6 you can lock the opened record but with ado.net I
don't know how to do this.

I am using vb.net and SQL Server.
thx.


Jan 19 '07 #2
HDI
What are the pro's and contra's of optimistic and pessimistic logging?
Robert Dufour schreef:
I agree, I've seen cases where a record was locked when it was opened. The
person going out to lunch, leaving it locked and others who needed access to
it being unable to get it until he/she came back and released the lock.
Not a good idea unless you realy think through and handle all the
unexpected problem scenarios, which is a lot of work.

Regards,
Bob
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:EC**********************************@microsof t.com...
HDI,

The disconnected architecture of ado.net encourages optimistic locking to
deal with concurrency issues. This is the approach used by most of the
ado.net code that I have encountered.

You can still make pessimistic locking work, but unless you have a really,
really good reason to do so, you should first consider using optimistic
locking.

Kerry Moorman
"HDI" wrote:
Hi,
I'm writing a windows application where users can update records but
how can I lock a record when a user opens it.

With ado and vb6 you can lock the opened record but with ado.net I
don't know how to do this.

I am using vb.net and SQL Server.
thx.

Jan 19 '07 #3
HDI
What are the pro's and contra's of optimistic and pessimistic locking?
Robert Dufour schreef:
I agree, I've seen cases where a record was locked when it was opened. The
person going out to lunch, leaving it locked and others who needed access to
it being unable to get it until he/she came back and released the lock.
Not a good idea unless you realy think through and handle all the
unexpected problem scenarios, which is a lot of work.

Regards,
Bob
"Kerry Moorman" <Ke**********@discussions.microsoft.comwrote in message
news:EC**********************************@microsof t.com...
HDI,

The disconnected architecture of ado.net encourages optimistic locking to
deal with concurrency issues. This is the approach used by most of the
ado.net code that I have encountered.

You can still make pessimistic locking work, but unless you have a really,
really good reason to do so, you should first consider using optimistic
locking.

Kerry Moorman
"HDI" wrote:
Hi,
I'm writing a windows application where users can update records but
how can I lock a record when a user opens it.

With ado and vb6 you can lock the opened record but with ado.net I
don't know how to do this.

I am using vb.net and SQL Server.
thx.

Jan 19 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: xixi | last post by:
hi, we are using db2 udb v8.1 ESE with type 4 jcc driver. since DB2 can't support pessimistic locking , and our application required that, which means when both users try to access the same record...
0
by: Andrew Cutforth | last post by:
I have a strange problem that I have not come across before. In a multi user situation I have a readonly query open. When another user tries to post a change to that record it says it is locked....
14
by: Gary Nelson | last post by:
Anyone have any idea why this code does not work? FileOpen(1, "c:\JUNK\MYTEST.TXT", OpenMode.Binary, OpenAccess.ReadWrite, OpenShare.Shared) Dim X As Integer For X = 1 To 26 FilePut(1, Chr(X +...
4
by: Ed L. | last post by:
I think I'm seeing table-level lock contention in the following function when I have many different concurrent callers, each with mutually distinct values for $1. Is there a way to reimplement...
8
by: Komandur Kannan | last post by:
We have a smart device application running on handhelds(Symbol MC9000G). The backend is Oracle and a middle tier web services development done in Vb.net. We use pessimistic Locking due to...
2
by: adri4n | last post by:
as wat ive mentioned in the title.. im would like to know whether the a particular record/table is being locked in my program. some of the methods which i would like to develop are as below: ...
2
by: shenanwei | last post by:
DB2 V8.2 on AIX, type II index is created. I see this from deadlock event monitor. 5) Deadlocked Connection ... Participant no.: 2 Lock wait start time: 09/18/2006 23:04:09.911774 .........
8
by: Ritesh Raj Sarraf | last post by:
Hi, I think there is some lock problem. Let me show the code first import os import sys import string import tempfile
5
by: payffl | last post by:
My users are running Access '03. They have a database with a form that allows them to enter new records. Frequently they will move to a new record and not enter any information. This prevents...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.