1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
Dim cmd As New SqlCommand Dim rdr As SqlDataReader Dim da As New SqlDataAdapter Dim ds As New DataSet con = New SqlConnection("Data Source=.;Initial Catalog=MoreExamples;Integrated Security=True") con.Open() sqlstr = "select CourseCode from CourseTable where CourseName='" & cboSearchColumn.Text & "'" cmd = New SqlCommand(sqlstr, con) dr = cmd.ExecuteReader() If dr.HasRows = True Then While dr.Read() = True txtSearch.Text = dr(0) End While End If con.Close() |

Leave a comment