Dim sql As String
Dim rs As Recordset
Dim db As Database
Set db = OpenDatabase("E:\图书馆数据库.mdb")
set rs=db.openrecordset("select * from table")
在这里面怎样使用
rs.delete
删除指定记录集

解决方案 »

  1.   

    recordset.Delete AffectRecords Parameters AffectRecords Optional. An AffectEnum value that determines how many records the Delete method will affect. Can be one of the following constants: adAffectCurrent Default. Delete only the current record. 
    adAffectGroup Delete the records that satisfy the current Filter property setting. You must set the Filter property to one of the valid predefined constants in order to use this option. 
      

  2.   

    How to set the filter property to delete group record
      

  3.   

    delete好象不能删多条记录,得用sql
      

  4.   

    Public Function ExecuteSQL(sql As String) As ADODB.Recordset
    Dim cn As ADODB.Connection
    Dim rst As ADODB.Recordset
    Set cn = New ADODB.Connection
    cn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=CY"
    Set rst = New ADODB.Recordset
    rst.Open Trim$(sql), cn, adOpenKeyset, adLockOptimistic
    Set ExecuteSQL = rst
    End Function
    sql = "select * from  Cgongzi where 编号='" & Trim(txt_id.Text) & "'"
    Set rs = ExecuteSQL(sql)
    Adodc1.RecordSource = sql
    rs.Delete
    MsgBox "恭喜、恭喜,你已经成功删除此项数据~!~", vbOKOnly + vbExclamation, "成功删除数据"
      

  5.   


    如果记录集名为rs
    包含LastName字段
    如下语句设置了一个记录集的Filter,使得只能看到LastName的第一个字母为d的记录:
    rs.filter="LastName like 'd*'"
    用下一语句恢复记录集
    rs.filter=adFilterNone  

    rs.filter=""
      

  6.   

    当设置好Filter以后,用
    rs.delete adAffectGroup
    即可删除符合条件的若干记录
      

  7.   

    delete 的默认值是:
    adAffectCurrent
    即当前记录
      

  8.   

    如果记录集名为rs
    包含LastName字段
    如下语句设置了一个记录集的Filter,使得只能看到LastName的第一个字母为d的记录:
    rs.filter="LastName like 'd*'"
    用下一语句恢复记录集
    rs.filter=adFilterNone  

    rs.filter=""
    ***************************************
    是这样设置吗?
    我现在用的sql删除,不过也想多了解一政