[求助]怎么将ListBox与数据库绑定
怎么将ListBox与数据库绑定???
Dim cmd_department As New SqlCommand("select * from Department where deptid='" & Trim(Me.TextBox1.Text) & "'", con_department)
Dim rd_department As SqlDataReader
rd_department = cmd_department.ExecuteReader(CommandBehavior.CloseConnection)
While rd_department.Read
ListBox1.Items.Add("deptid: " & vbnewline & rd_department.Item(0) & vbTab & "deptname: " & vbnewline & rd_department.Item(1) & vbTab & "deptdesc: " & vbnewline & rd_department.Item(2) & vbTab & " deptmgrid: " & vbnewline & rd_department.Item(3) & vbnewline)
End While