Hello everyone,
First I want to query an Access DB by column name (on a specific table): comparing a TextBox with the column name (therefor the below sql code)
Second, fill a listBox with the information that this column has.
Connection is already made.
On main form code I have:
I found that this code should return a List of column names:
How can I change it to return only the column name that is equal to txtDisp.text?
First I want to query an Access DB by column name (on a specific table): comparing a TextBox with the column name (therefor the below sql code)
Second, fill a listBox with the information that this column has.
Connection is already made.
On main form code I have:
Code:
Private Sub txtDisp_Leave(sender As Object, e As EventArgs) Handles txtDisp.Leave
Dim strSql As String = "SELECT column_name FROM Model WHERE ='" & txtDisp.Text & "'"
//HERE I SHOULD FILL A COMBOBOX WITH THE COLUMN NAME
Code:
Public Function nombreColumnas() As List(Of String)
Dim table As String = "Model"
Dim restrictions As String() = New String() {Nothing, Nothing, table , Nothing}
Dim dataTable As DataTable = conexion.GetSchema("Columns", restrictions)
Dim returnList As List(Of String) = New List(Of String)
For Each dataRow As DataRow In dataTable.Rows
returnList.Add(dataRow("column_name"))
Next
Return returnList
End Function