Results 1 to 3 of 3

Thread: ADO DataControl Connection

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2000
    Posts
    34

    Question

    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

  2. #2
    Guru Clunietp's Avatar
    Join Date
    Oct 1999
    Location
    USA
    Posts
    1,844
    This works fine for me
    Code:
        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

  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2000
    Posts
    34
    Thanks, I'll give it a try

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