Locking a database before modifications?

Results 1 to 2 of 2

Thread: Locking a database before modifications?

  1. #1
    Join Date
    Dec 1969

    Default Locking a database before modifications?

    I know that one should do this before editing a database but i&#039m not sure how. I have the following code.... what line(s) would i add to prevent problems during a multi-user modification:<BR><BR>&#060;!-- #INCLUDE FILE="adovbs.inc" --&#062;<BR>&#060;!--#include file="lib_errors.asp"--&#062;<BR><BR>&#060;%<BR>on error resume next<BR>aband=request.form("band")<BR>ainfo=reques t.form("info")<BR>alink=request.form("mlink")<BR>a webpage=request.form("webpage")<BR>Set Conn = Server.CreateObject("ADODB.Connection")<BR>conn.op en "DSN=lambgoat"<BR><BR>SQLstmt = "UPDATE Band SET info=&#039" & ainfo & "&#039, mlink=&#039" & alink & "&#039, webpage=&#039" & awebpage & "&#039 WHERE Band=&#039" & aband & "&#039"<BR>Set RS = Conn.Execute(SQLStmt)<BR><BR>Call ErrorVBScriptReport("Insert Statement")<BR>Call ErrorADOReport(SQLstmt,conn)<BR><BR>rs.close<BR>se t rs=nothing<BR>Conn.Close<BR>set conn=nothing%&#062;<BR><BR>thanks!!<BR><BR>

  2. #2
    RGibson Guest

    Default RE: Locking a database before modifications?

    You need to specify what lock type you want to use weather it be adLockOptimistic or adLockPessimistic. Be sure to include your adovbs.inc at the beginning of you page. This allows you to call adLockOptimistic by name instead of specifying a value.<BR>======================================== ========================<BR><BR>Set objUpdate = Server.CreateObject("ADODB.Recordset")<BR>strSQL = "SELECT * FROM table WHERE field=something"<BR>objUpdate.Open strSQL, objConn, adOpenKeyset, adLockOptimistic, adCmdText<BR><BR>objUpdate("field") = somevariable<BR>objUpdate.Update<BR><BR>========== ================================================== ====<BR>Hope this helps<BR><BR>-rg<BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts