Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

LockOptimistic Issue?

Posted on 2004-08-20
5
Medium Priority
?
876 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 1000 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

The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

Question has a verified solution.

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

In this post we will learn different types of Android Layout and some basics of an Android App.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Progress

722 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