I made a button to receive the texts from two combo boxes. The connection is OK and the names in the combo box too, but when I run the application for any two valid names I receive the message Invalid column name
. I'm sure that the column names are valid according to my data base.
Here's my code:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles btnProcesar.Click
sql.sqlcon.Open()
sql.sqlsentence = New SqlCommand("SELECT * FROM dbo.Univ$ WHERE Sector = " & ingSector.Text & " AND Ciudad = " & ingCiudad.Text, sql.sqlcon)
Dim adaptador As SqlDataAdapter
adaptador = New SqlDataAdapter(sql.sqlsentence)
Dim ds As New DataSet
adaptador.Fill(ds)
sql.sqlcon.Close()
dgrid.DataSource = ds.Tables(0)
End Sub
So, how can I fix that?