[求助]请教一个菜鸟级的问题,读数据库记录的问题.
如何读取数据库中的一个数据给一个文本框.........
是啊.......,先谢谢了
Dim conn As New SqlClient.SqlConnection
Dim strConn As String = "data source=127.0.0.1;initial catalog=hhdata;user id=sa;password=12345678;"
conn = New SqlClient.SqlConnection(strConn)
conn.Open()
Dim daaa As New SqlClient.SqlDataAdapter
Dim sqltile As String = "select s_username from s_user"
daaa.SelectCommand = New SqlClient.SqlCommand(sqltile, conn)
daaa.Fill(aa)
绑定用
TextBox1.DataBindings.Add("TEXT", aa.Tables(0), "s_username")
不绑定用
TextBox2.Text = aa.Tables(0).Rows(i)("s_username")