Data providers List in combo box
-
Hi all In C#.net or vc++ .net windows application, I want to have a list of data providers(like Microsoft OLE DB Provider for SQL Server,Microsoft OLE DB Provider for Oracle,Microsoft Access etc) in a combo box. So that I can connect to any database...How is it possible.... please help salai
Salai
-
Hi all In C#.net or vc++ .net windows application, I want to have a list of data providers(like Microsoft OLE DB Provider for SQL Server,Microsoft OLE DB Provider for Oracle,Microsoft Access etc) in a combo box. So that I can connect to any database...How is it possible.... please help salai
Salai
Imports System.Data.SqlClient Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ' Creating connection and command sting Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\northwind.mdb" Dim sqlStr As String = "SELECT * FROM Employees" ' Create connection object Dim conn As OleDbConnection = New OleDbConnection(conStr) ' Create data adapter object Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlStr, conn) ' Create a dataset object and fill with data using data adapter's Fill method Dim ds As DataSet = New DataSet da.Fill(ds, "Employees") ' Attach dataset's DefaultView to the datagrid control DataGrid1.DataSource = ds.DefaultViewManager End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click ' Creating connection and command sting Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\northwind.mdb" Dim sqlStr As String = "SELECT * FROM Employees" ' Create connection object Dim conn As OleDbConnection = New OleDbConnection(conStr) ' Create data adapter object Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlStr, conn) ' Create a dataset object and fill with data using data adapter's Fill method Dim ds As DataSet = New DataSet da.Fill(ds, "Employees") ' Attach dataset's DefaultView to the datagrid control Dim dv As DataView = ds.Tables("Employees").DefaultView ListBox1.DataSource = dv ListBox1.DisplayMember = "FirstName" End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click ' Creating connection and command sting Dim conStr As String = "Provider=Microsoft.JET.OLEDB.4.0;data source=c:\\northwind.mdb" Dim sqlStr As String = "SELECT * FROM Employees" ' Create connection object Dim conn As OleDbConnection = New OleDbConnection(conStr) ' Create data adapter object Dim da As OleDbDataAdapter = New OleDbDataAdapter(sqlStr, conn) ' Create a dataset object and fill with data using data adapter's Fill method Dim ds As DataSet = New DataSet da.Fill(ds, "Employees") ' Attach dataset's DefaultView to the datagrid control Dim dv As DataView = ds.Tables("Employees").DefaultView ComboBox1.DataSource = dv ComboBox1.DisplayMember = "FirstName" End Sub :rolleyes:BYE
Imagine the I.T