当前位置:编程学习 > C#/ASP.NET >>

怎样把select查询语句的结果显示在textbox中?下面的代码哪里不对呀?求帮助?

Dim str As String
        str = "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
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,