Results 1 to 2 of 2

Thread: About disconnected recordset

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Posts
    112

    About disconnected recordset

    Hi all,

    I wrote the following code and want to delete the filtered records from the disconnectd recordset. But when "rstb.Delete adAffectGroup" is executed, error occured saying ---> operation is not allowed in this context. What have i done wrong? Could any one please hep me? Thanks!

    Dim rsta As ADODB.Recordset

    Set rsta = New ADODB.Recordset

    Dim rstb As ADODB.Recordset
    With rsta
    .ActiveConnection = "dsn=Test1"
    .CursorLocation = adUseClient
    .CursorType = adOpenKeyset
    .LockType = adLockBatchOptimistic
    .Open "select * from test1"
    Set .ActiveConnection = Nothing
    End With

    Set rstb = rsta.Clone()

    rstb.Filter = "name <> 'z'"

    rstb.Delete adAffectGroup

  2. #2
    Fanatic Member
    Join Date
    Aug 2001
    Location
    Connecticut
    Posts
    855
    This article mentions that you can't use adAffectGroup without first setting the filter property of the recordset to one of the filter constants: adFilterNone, adFilterPendingRecords, adFilterAffectedRecords, or adFilterFetchRecords. adFilterFetchRecords is probably the choice here.

    http://www.ccc.ac.th/iasdocs/aspdocs...p/dameth02.htm
    http://www.ccc.ac.th/iasdocs/aspdocs...daprop03_5.htm
    VB 6.0, Access, Sql server, Asp

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