Results 1 to 7 of 7

Thread: VB6, ADO to acess DB occasional locking problem

Threaded View

  1. #1

    Thread Starter
    New Member
    Join Date
    Jan 2005
    Posts
    9

    VB6, ADO to acess DB occasional locking problem

    Hi,

    I am getting a seemingly random locking problem on several of my applications when adding rows to an access database table from VB6 using ADO.

    Below is an example of what I am doing, but it is basically looping through an array of data and adding rows to a table using a recordset.

    The error is '-2147217887: could not update; currently locked' and I've had it happen on my development machine with no one else accessing the database.

    I've tried different combinations of lock type and cursor type with no luck.

    Dim rsData As New Recordset
    Dim x As Integer


    sProvider = "Provider=Microsoft.Jet.OLEDB.4.0;Persist Security Info=False;Data Source=" & sDBPath

    rsData.Open "stock", sProvider, adOpenDynamic, adLockPessimistic

    For x = 1 To xaData.Count(1)
    rsData.AddNew
    rsData!item_code = sData(x,1)
    rsData!description = sData(x,2)
    rsData.Update
    Next

    Is there a better way to add the data?

    Cheers
    Marc
    Last edited by uczmeg; Jul 13th, 2006 at 10:14 AM.

Posting Permissions

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



Click Here to Expand Forum to Full Width