Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Location
    Mumbai, India
    Posts
    15

    Question Unanswered: connection to sql thru vb(urgt)

    I am final yr student and am working on a proj for a school and have a doubt regarding the sql connection...

    well, in order to establish a client server system it is essential to maintain mutual exclusion (no two write permissions to the same table on a database...). for this

    set con = new ADODB.Connection
    set rs = new ADODB.Recordset
    .
    .
    .
    .
    .
    rs.open "select * from table", con, adOpenDynamic, adLockOptimistic


    I am not sure if adOpenDynamic, adLockOptimistic are the right combination for that...please help me out...its urgent...the abouve is what I have used ..my submission date is closing in...Thanxs

  2. #2
    Join Date
    Mar 2004
    Location
    www.scirocco.ca
    Posts
    346

    Re: connection to sql thru vb(urgt)

    I think a combination of adOpenDynamic and adLockPessimistic is the safest for your criteria of preventing two users from writing to the same record at the same time. Does everybody else agree?

    Here are the two sets of 4 options for your review:
    ===============================
    adLockBatchOptimistic 4 Indicates optimistic batch updates. Required for batch update mode.

    adLockOptimistic 3 Indicates optimistic locking, record by record. The provider uses optimistic locking, locking records only when you call the Update method.

    adLockPessimistic 2 Indicates pessimistic locking, record by record. The provider does what is necessary to ensure successful editing of the records, usually by locking records at the data source immediately after editing.

    adLockReadOnly 1 Indicates read-only records. You cannot alter the data.
    ===============================
    adOpenDynamic 2 Uses a dynamic cursor. Additions, changes, and deletions by other users are visible, and all types of movement through the Recordset are allowed, except for bookmarks, if the provider doesn't support them.

    adOpenForwardOnly 0 Default. Uses a forward-only cursor. Identical to a static cursor, except that you can only scroll forward through records. This improves performance when you need to make only one pass through a Recordset.

    adOpenKeyset 1 Uses a keyset cursor. Like a dynamic cursor, except that you can't see records that other users add, although records that other users delete are inaccessible from your Recordset. Data changes by other users are still visible.

    adOpenStatic 3 Uses a static cursor. A static copy of a set of records that you can use to find data or generate reports. Additions, changes, or deletions by other users are not visible.
    http://www.scirocco.ca/images/banner...occobanner.gif

    Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!

    Or try our Ask An Expert service to answer any of your questions!

Posting Permissions

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