引用microsoft activex data object
dim cn as new adodb.connection
dim rs as new adodb.recordset
dim sqlconnectionstr as string
dim sqlsentence as string
sqlconnectionstr="Provider=SQLOLEDB.1;Password=数据库密码;Persist Security Info=True;User ID=sa;Initial Catalog=数据库对象名;Data Source=数据库地址"
sqlsentence=数据库检索语句
cn.connectionstring=sqlconnectionstr
cn.open
rs.open sql,cn,1,1
do while not rs.eof
listbox1.additem rs.fields("字段名称").value
rs.movenext
loop
利用循环加入