Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21238

[RESOLVED] Multiple dbUpdateBatch commands?

$
0
0
We use an Access 2000 (VB 6.0) procedure (written by someone else) to update an SQL server database on a web server using .dbf update files. The program deletes every record of an SQL table, then repopulates it using the data from a .dbf file using the DAO .dbUpdateBatch method. It appears that recently our .dbf file has reached a size limit for this method (~60 mb), and now the update fails. I have just a basic knowledge of VB, and we set up a duplicate database to play around on. My first thought was that I could do a .dbUpdateBatch after every, say, 10000 records. These 10000 records do get inserted, and the next .update commands seem to be working ok, but then I get a 3146 error sometime before the next .dbUpdateBatch executes. Am I way off base here? Any help you could give would be much appreciated. Here's the section of code in question:
Code:

Set wrkODBC = CreateWorkspace("NewODBCWorkspace", _
        "...", "...", dbUseODBC)
wrkODBC.DefaultCursorDriver = dbUseClientBatchCursor
Set conWeb = wrkODBC.OpenConnection("", , , "ODBC;DSN=...;UID=...;PWD=...")
Set WebProductSet = conWeb.OpenRecordset("Product", dbOpenDynamic, dbExecDirect, dbOptimisticBatch)
Set ProductSet = CurrentDb.OpenRecordset("webprod")
ProdCount = 0
ProductSet.MoveFirst
Do Until ProductSet.EOF
    With WebProductSet
        .AddNew
        !PRODUCT_ID = ProductSet!PRODUCT_ID
        !PartNo = ProductSet!PartNo
        !Description = ProductSet!DESCRIPTIO
        .
        .
        .
        WebProductSet.Update
       
        ' Here's my attempted work-around. This wasn't here originally
        ProdCount = ProdCount + 1
        If ProdCount = 10000 Then
          WebProductSet.Update dbUpdateBatch
          ProdCount = 0
        End If
       
        ProductSet.MoveNext
    End With
Loop

WebProductSet.Update dbUpdateBatch


Viewing all articles
Browse latest Browse all 21238

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>