DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2

Thread: UpdateBatch Error?

  1. #1
    Reid Nix Guest

    UpdateBatch Error?

    Hi

    My update operation posts the wrong values to the OLE DB when I use a loop
    to update a column in an Access Table.

    I use adOpenKeyset, adLockBatchOptimistic & updateRS.UpdateBatch.

    The following code should simply number all records....1,2,3,4,5
    Do Until updateRS.EOF
    updateRS.Update (sCol), updateRS.AbsolutePosition
    updateRS.MoveNext
    Loop

    updateRS.UpdateBatch

    The updated recordset shows 1,2,3,4,5.....no problem. But the OLE DB shows
    1,2,6,6,5,1....... The two 6's have the same value in a certain field.

    The recordset of the operation looks fine but when I look at the table by
    another means I see the columns posted as though the UpdateBatch command
    included an
    WHERE clause. The columns get posted according to a 2 field grouping.

    Thanx










  2. #2
    Thomas Eyde Guest

    Re: UpdateBatch Error?

    Works find with me, I use following code and table layout:
    Access2000:
    Test: Table
    PKID: Autonumber, Primary Key
    Number: Number, long

    (Add 5 records, give each Number field a value of 0)

    Public Sub Test()
    Dim sConnect As String
    Dim oRS As New ADODB.Recordset

    sConnect = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path &
    "\Test.mdb;Persist Security Info=False"

    With oRS
    .CursorLocation = adUseClient
    Call .Open("SELECT PKID, Number FROM Test", sConnect, adOpenKeyset,
    adLockBatchOptimistic)

    Set .ActiveConnection = Nothing

    Do Until .EOF
    Call .Update("Number", .AbsolutePosition)
    Call .MoveNext
    Loop

    .ActiveConnection = sConnect
    Call .UpdateBatch

    End With

    End Sub

    --
    /Thomas
    thomas.eyde@eunet.no


    Reid Nix <reid.nix@nixlogic.com> wrote in message
    news:3986b9ae@news.devx.com...
    > Hi
    >
    > My update operation posts the wrong values to the OLE DB when I use a loop
    > to update a column in an Access Table.
    >
    > I use adOpenKeyset, adLockBatchOptimistic & updateRS.UpdateBatch.
    >
    > The following code should simply number all records....1,2,3,4,5
    > Do Until updateRS.EOF
    > updateRS.Update (sCol), updateRS.AbsolutePosition
    > updateRS.MoveNext
    > Loop
    >
    > updateRS.UpdateBatch
    >
    > The updated recordset shows 1,2,3,4,5.....no problem. But the OLE DB

    shows
    > 1,2,6,6,5,1....... The two 6's have the same value in a certain field.
    >
    > The recordset of the operation looks fine but when I look at the table by
    > another means I see the columns posted as though the UpdateBatch command
    > included an
    > WHERE clause. The columns get posted according to a 2 field grouping.
    >
    > Thanx
    >
    >
    >
    >
    >
    >
    >
    >
    >




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center