Opening a Database from a MSDASC DataLink

The code below currently open a dialog box and allows the user to select/create a database connection.  It returns the connection string.  Once this string is returned I need it to display the data in a DataGrid in a Windows Form.  Could someone please help me out on this, thanks.

Private Sub DataSourceToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DataSourceToolStripMenuItem.Click
        Dim mydlg As New MSDASC.DataLinks()
        Dim ADOcon As New ADODB.Connection()

        ADOcon = mydlg.PromptNew
        Try
            ADOcon.Open()
            If ADOcon.State = 1 Then
                'connection string returned from dialog box
                MsgBox(ADOcon.ConnectionString)
            Else
                MsgBox("Connection Failed")
            End If

        Catch ex As Exception

        End Try

    End Sub
dhathsatoAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bob LearnedCommented:
Is it going to be a varying set of database types that you need to connect to?

Bob
0
dhathsatoAuthor Commented:
If by varying database types you mean Acces, SQL, etc., then yes that is correct.  The user will be creating their user defined connection to their user defined database.  Hope this helped,
0
Bob LearnedCommented:
What I was really asking, though, is are you looking to access things like MySql, DB2, Informix, etc?  All those non-standard database types that need a special .NET data provider installed.

Bob
0
dhathsatoAuthor Commented:
nope, will be access and dbf files
0
Bob LearnedCommented:
If you don't have non-standard database types, then you can use the connection string to initialize an OleDbConnection.

Bob
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic.NET

From novice to tech pro — start learning today.