标题:[求助]怎么将ListBox与数据库绑定
只看楼主
蓝色骑士
Rank: 1
等 级:新手上路
帖 子:9
专家分:0
注 册:2006-1-9
 问题点数:0 回复次数:1 
[求助]怎么将ListBox与数据库绑定
怎么将ListBox与数据库绑定???
搜索更多相关主题的帖子: ListBox 绑定 数据库 
2006-04-15 21:00
feeling
Rank: 4
来 自:福建厦门
等 级:贵宾
威 望:10
帖 子:105
专家分:0
注 册:2006-3-29
得分:0 

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


互相学习! 不要放弃!时刻相信自己! 信心,是我们撑起世界的\'武器\'! 只怕你不肯学,而不怕自己学不会!
2006-04-16 08:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-57728-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.531993 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved