怎样把select查询语句的结果显示在textbox中?下面的代码哪里不对呀?求帮助?
Dim str As Stringstr = "user id=sa;password=57957549;initial catalog=banksystem1;data source=PC-20111127MOMH\SQLEXPRESS"
Dim con As New SqlConnection(str)
con.Open()
Dim sql As String = "select [BranchNo.] from Employee where [EmployeeNo.] = '" & Label15.Text.ToString().Trim() & "'"
Dim cmd As New SqlCommand(sql, con)
Dim MyReader As SqlDataReader = cmd.ExecuteReader
If MyReader.HasRows Then
While MyReader.Read
TextBox9.Text = MyReader("[BranchNo.] ")
End While
End If
MyReader.Close()
con.Close() vb.net --------------------编程问答-------------------- 没仔细看
TextBox9.Text = TextBox9.Text + MyReader("[BranchNo.] ") --------------------编程问答-------------------- 已经解决了,不过还是谢谢啦~
补充:.NET技术 , VB.NET