Solved

LockOptimistic Issue?

Posted on 2004-08-20
5
866 Views
Last Modified: 2012-06-21
1. If one routine is looking at the record  will the LockOptimistic prevent it from accessing it and visa versa?

Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set objConnection = CreateObject("ADODB.Connection")
Set objRecordset = CreateObject("ADODB.Recordset")
objConnection.Open "DSN=DBDSN;UID=System;PWD=xxxxx;DATABASE=DBName"
objRecordset.CursorLocation = adUseClient

errMessage = "Died opening Recordset"

objRecordset.Open "SELECT * FROM tblFirewall WHERE tblFirewall.FirewallIP Like '" & FirewallIP & "'", objConnection, adOpenStatic, adLockOptimistic
    If objRecordset.BOF Then
    Else
        strFirewallPW = objRecordset("FirewallPW")
            FirewallPW = strFirewallPW
        strFirewallEN = objRecordset("FirewallEN")
            FirewallEN = strFirewallEN
        strFirewallSSH = objRecordset("FirewallSSH")
            FirewallSSH = strFirewallSSH
       
  End If
       
        objRecordset.Close
        objConnection.Close
0
Comment
Question by:brian_appliedcpu
[X]
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
  • 3
  • 2
5 Comments
 
LVL 3

Accepted Solution

by:
kumvjuec earned 250 total points
ID: 11858293
It locks only when update is called. Since you are only using select above, it will not lock.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdcstlocktypeenum.asp
0
 
LVL 2

Author Comment

by:brian_appliedcpu
ID: 11858815
So do I even need to use the lock when I don't plan on updating the record?
Or in this case should I use adLockReadOnly?
0
 
LVL 2

Author Comment

by:brian_appliedcpu
ID: 11858970
PS..

do I need the lock with the
sql = "insert into tblError...

What is the rule of thumb?  to always use it?
0
 
LVL 3

Expert Comment

by:kumvjuec
ID: 11859771
Read it here and use based on what your exact need is :)
http://www.tek-tips.com/faqs.cfm?fid=618
0
 
LVL 2

Author Comment

by:brian_appliedcpu
ID: 11862230
Exellent article...thanks for the link.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
Starting up a Project

632 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