Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2003
    Posts
    10

    Red face Unanswered: Using Disconnected Recordsets

    Please Help...

    I have an original table from wich I need to manipulate data and insert this changed data into a new table...all without altering the data values in my original table. I thought the best way to do this would be to use disconnected recordsets.

    So, First I open my recordset, RS, which contains all the original values from my origin table. Lets say there are 1000 original rowsets.

    Next I set my active connection to Nothing to make my recordset disconnected : RS.ActiveConnection = Nothing

    Next I process my disconnected recordset through an IF statement that deletes any rowsets that contain a value = 0. If I put a counter within this IF statement, it says that there are 100 rowsets that contain zeros and were supposedly deleted.

    However, if I count the number of rowsets after the supposed deletion I still have 1000 rowsets, and if I insert this "altered" Recordset into my new table the zeros in my data were never deleted.

    Does anyone now how to manipulate and edit the disconnected recordset so that it will reflect the changes when I insert it into my new table? Is there an update command or something like this that needs to be performed before my recordset will reflect the changes?

    Thanks for any input you might have!! And if you need actual code to help me trouble shoot, just let me know....thanks again.

    -TRoche

  2. #2
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    45

    UpdateBatch?

    Did you perform the UpdateBatch to persist changes to the database already?

    The records will need to still be in the disconnected recordset after you delete them so that they can be deleted from the actual table once you reconnect and update the database with the changes.

    I have not tried disconnecting from one connection, doing changes and persisting them to another connection. That might produce errors if they are not identical to begin with.

    /Robert

  3. #3
    Join Date
    Sep 2003
    Posts
    10

    Re: UpdateBatch?

    I haven't tried this...

    I will as soon as I can, but do you have a sample script showing this UpdateBatch syntax?

    Thanks for you help and I will give it a shot!

    -TRoche

  4. #4
    Join Date
    Oct 2003
    Location
    Sweden
    Posts
    45

    Re: UpdateBatch?

    Originally posted by TRoche
    I haven't tried this...

    I will as soon as I can, but do you have a sample script showing this UpdateBatch syntax?

    Thanks for you help and I will give it a shot!

    -TRoche

    It's really quite simple.
    You first reconnect your disconnected recordset after performing the updates, the just call UpdateBatch. This method takes one optional parameter with which you can declare which records to update, default is all records.

    set rs.ActiveConnection = YourConnection
    rs.UpdateBatch

Posting Permissions

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