yes....
Public Overrides Function GetSchema(ByVal collectionName As String) As System.Data.DataTable
Member of: System.Data.SqlClient.SqlConnection
Summary:Returns schema information for the data source of this System.Data.SqlClient.SqlConnection using the specified string for the schema name.Parameters:
collectionName: Specifies the name of the schema to return.Return Values:
A System.Data.DataTable that contains schema information.
SQL Statement will return you the list of tables in a selected/using database:
SELECT name FROM sysobjects WHERE type = 'U'
you can execute this command in the SQL Command, and then fill the datatable with the results using a SqlDataAdapter
Dim theSQLCommand as new SqlCommand("SELECT name FROM sysobjects WHERE type = 'U')
Dim theDataSet as new DataSet()
Dim theDataAdapter as new SqlDataAdapter(theSQLCommand)
theSqlCommand.Connection = new SqlConnection(connectionString)
theSqlCommand.Connection.Open()
theDataAdapter.Fill(theDataSet)
theSqlCommand.Connection.Close()
results should now be stored in:
theDataSet.Tables(0)
does this help?
yes thank you both. it works now right, but what if i want results to combobox. now it shows just some text. i guess the problem is displaymember property.
to display it in a combo box:
Me.theComboBox.DataSource = theDataTable.DefaultView
Me.theComboBox.DisplayMember = theFieldName
Now, if you are using the datatable approach, then this is fine. Be sure to modify the displaymember property to tell it to "bind" a specific column, such as "Name" from my example
does this help?