Opening a Database from a MSDASC DataLink

Posted on 2006-04-06
Last Modified: 2008-01-09
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
            If ADOcon.State = 1 Then
                'connection string returned from dialog box
                MsgBox("Connection Failed")
            End If

        Catch ex As Exception

        End Try

    End Sub
Question by:dhathsato
    LVL 96

    Expert Comment

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


    Author Comment

    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,
    LVL 96

    Expert Comment

    by:Bob Learned
    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.


    Author Comment

    nope, will be access and dbf files
    LVL 96

    Accepted Solution

    If you don't have non-standard database types, then you can use the connection string to initialize an OleDbConnection.


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Top 6 Sources for Identifying Threat Actor TTPs

    Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

    It’s quite interesting for me as I worked with Excel using for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
    Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
    Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now