I am trying to get the name of a single column in a table and use that in a query for sorting.
As an example of what I'm trying to achieve would be as follow:
TableA has 2 columns: "FirstName" and "LastName".
I make a query to
SELECT * FROM TableA WHERE LIKE [column 2 (LastName)]
You can call a specific column name from a datatable. It means, you will have to pass the informations first from db to datatable. Example: Dim Con as New SqlConnection("ur connection str") Dim da as New SqlDataAdapter("Select * from [table]",Con) Dim dt as New Datatable da.Fill(dt) Me.Label1.Text = dt.Columns(1).ColumnName
Hope it helps.. :)