Ado Recorded locking 
Author Message
 Ado Recorded locking

I have a Table that is very important that only one person
can edited a record at a time.  How can I check if some
one is already editing it and tell the user the the record
is being used at the time?  I'm converting from DAO access
to SQL, I could do it in DAO.  Only programs accessing the
date file is my VB program.


Sat, 21 May 2005 01:17:03 GMT  
 Ado Recorded locking
ADO supports the ability to create a "pessimistic" lock. That is, you can
execute a query that selects one or more rows (depending on the provider)
that remain locked as long as the Recordset is open. I drone on and on about
this in my book where I also discuss how this can cause all kinds of
scalability problems if not handled properly.
All you need to do is request the adLockPessimistic when you define or open
your Recordset. This only works for server-side cursors and then only with
specific providers. The SqlOleDB provider is one of them.

hth

--
William (Bill) Vaughn, Author, Trainer, Mentor
Microsoft Pacwest Regional Director, MVP
"ADO and ADO.NET Examples and Best Practices for VB Programmers--2nd
Edition" (ISBN: 1-893115-68-2)
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
________________________________


Quote:
> I have a Table that is very important that only one person
> can edited a record at a time.  How can I check if some
> one is already editing it and tell the user the the record
> is being used at the time?  I'm converting from DAO access
> to SQL, I could do it in DAO.  Only programs accessing the
> date file is my VB program.



Sat, 21 May 2005 01:56:14 GMT  
 Ado Recorded locking
Thank Bill,

Once I do that how do I check if some one is in the edit
mode of that record.

Tom

Quote:
>-----Original Message-----
>I have a Table that is very important that only one
person
>can edited a record at a time.  How can I check if some
>one is already editing it and tell the user the the
record
>is being used at the time?  I'm converting from DAO
access
>to SQL, I could do it in DAO.  Only programs accessing
the
>date file is my VB program.

>.



Sat, 21 May 2005 04:03:36 GMT  
 Ado Recorded locking
Once another user attempts to access the row (or page in some cases), they
are blocked and eventually time out.

--
William (Bill) Vaughn, Author, Trainer, Mentor
Microsoft Pacwest Regional Director, MVP
"ADO and ADO.NET Examples and Best Practices for VB Programmers--2nd
Edition" (ISBN: 1-893115-68-2)
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
________________________________


Quote:
> Thank Bill,

> Once I do that how do I check if some one is in the edit
> mode of that record.

> Tom

> >-----Original Message-----
> >I have a Table that is very important that only one
> person
> >can edited a record at a time.  How can I check if some
> >one is already editing it and tell the user the the
> record
> >is being used at the time?  I'm converting from DAO
> access
> >to SQL, I could do it in DAO.  Only programs accessing
> the
> >date file is my VB program.

> >.



Sat, 21 May 2005 06:48:14 GMT  
 Ado Recorded locking
Again thanks for your reply.

I have an edit button when the second user hits the edit
button how can I trap by error code or something that the
record is already locked?

Tom

Quote:
>-----Original Message-----
>Once another user attempts to access the row (or page in
some cases), they
>are blocked and eventually time out.

>--
>William (Bill) Vaughn, Author, Trainer, Mentor
>Microsoft Pacwest Regional Director, MVP
>"ADO and ADO.NET Examples and Best Practices for VB
Programmers--2nd
>Edition" (ISBN: 1-893115-68-2)
>www.betav.com
>Please reply only to the newsgroup so that others can
benefit.
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>________________________________



>> Thank Bill,

>> Once I do that how do I check if some one is in the edit
>> mode of that record.

>> Tom

>> >-----Original Message-----
>> >I have a Table that is very important that only one
>> person
>> >can edited a record at a time.  How can I check if some
>> >one is already editing it and tell the user the the
>> record
>> >is being used at the time?  I'm converting from DAO
>> access
>> >to SQL, I could do it in DAO.  Only programs accessing
>> the
>> >date file is my VB program.

>> >.

>.



Sat, 21 May 2005 08:48:57 GMT  
 Ado Recorded locking
Which language? ADO or ADO.NET?

--
William (Bill) Vaughn, Author, Trainer, Mentor
Microsoft Pacwest Regional Director, MVP
"ADO and ADO.NET Examples and Best Practices for VB Programmers--2nd
Edition" (ISBN: 1-893115-68-2)
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
________________________________


Quote:
> Again thanks for your reply.

> I have an edit button when the second user hits the edit
> button how can I trap by error code or something that the
> record is already locked?

> Tom

> >-----Original Message-----
> >Once another user attempts to access the row (or page in
> some cases), they
> >are blocked and eventually time out.

> >--
> >William (Bill) Vaughn, Author, Trainer, Mentor
> >Microsoft Pacwest Regional Director, MVP
> >"ADO and ADO.NET Examples and Best Practices for VB
> Programmers--2nd
> >Edition" (ISBN: 1-893115-68-2)
> >www.betav.com
> >Please reply only to the newsgroup so that others can
> benefit.
> >This posting is provided "AS IS" with no warranties, and
> confers no rights.
> >________________________________



> >> Thank Bill,

> >> Once I do that how do I check if some one is in the edit
> >> mode of that record.

> >> Tom

> >> >-----Original Message-----
> >> >I have a Table that is very important that only one
> >> person
> >> >can edited a record at a time.  How can I check if some
> >> >one is already editing it and tell the user the the
> >> record
> >> >is being used at the time?  I'm converting from DAO
> >> access
> >> >to SQL, I could do it in DAO.  Only programs accessing
> >> the
> >> >date file is my VB program.

> >> >.

> >.



Sat, 21 May 2005 10:40:26 GMT  
 Ado Recorded locking
I'm using VB6.0 Sp5 and ado.

Thanks,
Tom

Quote:
>-----Original Message-----
>Which language? ADO or ADO.NET?

>--
>William (Bill) Vaughn, Author, Trainer, Mentor
>Microsoft Pacwest Regional Director, MVP
>"ADO and ADO.NET Examples and Best Practices for VB
Programmers--2nd
>Edition" (ISBN: 1-893115-68-2)
>www.betav.com
>Please reply only to the newsgroup so that others can
benefit.
>This posting is provided "AS IS" with no warranties, and
confers no rights.
>________________________________



>> Again thanks for your reply.

>> I have an edit button when the second user hits the edit
>> button how can I trap by error code or something that
the
>> record is already locked?

>> Tom

>> >-----Original Message-----
>> >Once another user attempts to access the row (or page
in
>> some cases), they
>> >are blocked and eventually time out.

>> >--
>> >William (Bill) Vaughn, Author, Trainer, Mentor
>> >Microsoft Pacwest Regional Director, MVP
>> >"ADO and ADO.NET Examples and Best Practices for VB
>> Programmers--2nd
>> >Edition" (ISBN: 1-893115-68-2)
>> >www.betav.com
>> >Please reply only to the newsgroup so that others can
>> benefit.
>> >This posting is provided "AS IS" with no warranties,
and
>> confers no rights.
>> >________________________________



>> >> Thank Bill,

>> >> Once I do that how do I check if some one is in the
edit
>> >> mode of that record.

>> >> Tom

>> >> >-----Original Message-----
>> >> >I have a Table that is very important that only one
>> >> person
>> >> >can edited a record at a time.  How can I check if
some
>> >> >one is already editing it and tell the user the the
>> >> record
>> >> >is being used at the time?  I'm converting from DAO
>> >> access
>> >> >to SQL, I could do it in DAO.  Only programs
accessing
>> >> the
>> >> >date file is my VB program.

>> >> >.

>> >.

>.



Sat, 21 May 2005 21:20:04 GMT  
 Ado Recorded locking
Thanks for the info.

I also have been trying to get the answer to a similar question.

I think the query is how to find whether the record (or page) is locked
by someone else, and then offer the user an option to quit trying to
access (edit) the record, or wait some time, and try again.

Is there some message or error code that is returned when a record is
locked, which one can trap and then offer different options.

tia

Vikram

Quote:

> ADO supports the ability to create a "pessimistic" lock. That is, you can
> execute a query that selects one or more rows (depending on the provider)
> that remain locked as long as the Recordset is open. I drone on and on about
> this in my book where I also discuss how this can cause all kinds of
> scalability problems if not handled properly.
> All you need to do is request the adLockPessimistic when you define or open
> your Recordset. This only works for server-side cursors and then only with
> specific providers. The SqlOleDB provider is one of them.

> hth



Sun, 22 May 2005 02:24:26 GMT  
 Ado Recorded locking
With VB6/ADO your code needs to setup an ON ERROR GOTO handler to trap the
Timeout. When the second user tries to access the locked data row (or page
the row lives on), they will get a timeout error after CommandTimeout
seconds. I have copious examples of this in my book.

hth

--
________________________________
William (Bill) Vaughn, Author, Trainer, Mentor
Microsoft Pacwest Regional Director, MVP
"ADO.NET and ADO Examples and Best Practices for VB Programmers--2nd
Edition" (ISBN: 1-893115-68-2)
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no rights.
________________________________


Quote:
> I'm using VB6.0 Sp5 and ado.

> Thanks,
> Tom

> >-----Original Message-----
> >Which language? ADO or ADO.NET?

> >--
> >William (Bill) Vaughn, Author, Trainer, Mentor
> >Microsoft Pacwest Regional Director, MVP
> >"ADO and ADO.NET Examples and Best Practices for VB
> Programmers--2nd
> >Edition" (ISBN: 1-893115-68-2)
> >www.betav.com
> >Please reply only to the newsgroup so that others can
> benefit.
> >This posting is provided "AS IS" with no warranties, and
> confers no rights.
> >________________________________



> >> Again thanks for your reply.

> >> I have an edit button when the second user hits the edit
> >> button how can I trap by error code or something that
> the
> >> record is already locked?

> >> Tom

> >> >-----Original Message-----
> >> >Once another user attempts to access the row (or page
> in
> >> some cases), they
> >> >are blocked and eventually time out.

> >> >--
> >> >William (Bill) Vaughn, Author, Trainer, Mentor
> >> >Microsoft Pacwest Regional Director, MVP
> >> >"ADO and ADO.NET Examples and Best Practices for VB
> >> Programmers--2nd
> >> >Edition" (ISBN: 1-893115-68-2)
> >> >www.betav.com
> >> >Please reply only to the newsgroup so that others can
> >> benefit.
> >> >This posting is provided "AS IS" with no warranties,
> and
> >> confers no rights.
> >> >________________________________



> >> >> Thank Bill,

> >> >> Once I do that how do I check if some one is in the
> edit
> >> >> mode of that record.

> >> >> Tom

> >> >> >-----Original Message-----
> >> >> >I have a Table that is very important that only one
> >> >> person
> >> >> >can edited a record at a time.  How can I check if
> some
> >> >> >one is already editing it and tell the user the the
> >> >> record
> >> >> >is being used at the time?  I'm converting from DAO
> >> >> access
> >> >> >to SQL, I could do it in DAO.  Only programs
> accessing
> >> >> the
> >> >> >date file is my VB program.

> >> >> >.

> >> >.

> >.



Sun, 22 May 2005 03:29:22 GMT  
 
 [ 9 post ] 

 Relevant Pages 

1. ADO - Record locking

2. VB6/ADO Record locking issue

3. Ado Record Locking in Mutiuser System

4. Help with ADO record locking

5. ADO Record Locking

6. ADO Record Locking Question

7. ADO - Record lock

8. ADO Record Locking

9. VB6/ADO record locking: how to stop others reading ?

10. ADO and a counter in a record ->lock a record with mulituser

11. Record Locking - Is there a way to test to see if a record has been locked

12. Urgent!!!Record Locking in ADO.NET

 

 
Powered by phpBB® Forum Software