# Re: 我要删除 ADO 连线过的档案，可是删除不了．．．．．．

Posted by 阿毛 on April 11, 1999 at 19:49:54:

In Reply to: 我要删除 ADO 连线过的档案，可是删除不了．．．．．． posted by 小蓉 on April 10, 1999 at 17:01:11:

'再试试看合不合用...(我先try过了)
Const FileName = "E:\superlib.mdb"
Dim adoconn As New ADODB.Connection
Dim adorst As New ADODB.Recordset
Dim adocmd As New ADODB.Command
Private Sub Form_Load()

'DataGrid, Adodc, CommandButton
'到ODBC控制台去新增一个DSN(资料来源)
'选择 Microsoft Access这个Driver

adoconn.ConnectionString = "DSN=test;UID=SA;PSW;"
adoconn.Open
adocmd.CommandText = "D01"
adocmd.ActiveConnection = adoconn
adorst.Open adocmd, , adOpenKeyset

Set Adodc1.Recordset = adorst
Set DataGrid1.DataSource = Adodc1
End Sub

Private Sub Command1_Click()

adorst.Close
adoconn.Close

If MsgBox("确定删除" & FileName & " ??", vbYesNo) = vbYes Then
Kill FileName
End If
DoEvents

End Sub

Follow Ups: