dhathsato
asked on
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 DataSourceToolStripMenuIte m_Click(By Val sender As System.Object, ByVal e As System.EventArgs) Handles DataSourceToolStripMenuIte m.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.ConnectionSt ring)
Else
MsgBox("Connection Failed")
End If
Catch ex As Exception
End Try
End Sub
Private Sub DataSourceToolStripMenuIte
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.ConnectionSt
Else
MsgBox("Connection Failed")
End If
Catch ex As Exception
End Try
End Sub
ASKER
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,
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
Bob
ASKER
nope, will be access and dbf files
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Bob