PDA

Click to See Complete Forum and Search --> : ADO DataControl Connection


Asterisk
Aug 6th, 2000, 11:52 AM
I have an ADO DataControl which i at runtime connect to a database by using the ConnectionString and RecordSource properties. But what i now need to do is disconnect the control from the database so that i can delete the database. I know how to do this using the ADO objects but have not been able to do the same thing with the datacontrol. Is it possible ?

Thanks

Clunietp
Aug 6th, 2000, 02:16 PM
This works fine for me

Dim strDBName As String

strDBName = "F:\Nwind2k.mdb"

'open db
With Me.Adodc1

.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & strDBName
.RecordSource = "Select * from Customers"
.Refresh

.Recordset.Requery

'we have a value
MsgBox .Recordset(0)


'close

.Recordset.Close
Set .Recordset = Nothing
.ConnectionString = ""
.RecordSource = ""

'kill db
Kill strDBName
End With

Asterisk
Aug 6th, 2000, 02:56 PM
Thanks, I'll give it a try