注册 登录
编程论坛 VB6论坛

请问用ado控件如何删除access中找到的多条记录?

ybsh 发布于 2012-12-24 22:34, 407 次点击
下面是我自己写的程序 可是有问题 谁能帮忙修改一下
Private Sub Form_Load()
  Adodc1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\加工数据库.mdb;persist security info=false"
  Adodc1.RecordSource = "select 编号,姓名,日期 from 员工表,员工出勤表 where 员工表 order by 日期"
  Set DataGrid1.DataSource = Adodc1
End Sub

Private Sub Command4_Click()
    Dim i As Integer
    For i = 0 To Adodc1.Recordset.RecordCount - 1
        Adodc1.Recordset.Delete
        Adodc1.Recordset.Update
        Adodc1.Recordset.MoveFirst
        Adodc1.Refresh
    Next i
   
   ' Do Until Adodc1.Recordset.EOF
     ' Adodc1.Recordset.Delete
     ' Adodc1.Refresh
     ' Adodc1.Recordset.MoveNext
      
    '  Set DataGrid1.DataSource = Adodc1
 '  Loop
     
   MsgBox "信息已删除", , ""
End Sub
0 回复
1