编程论坛 » VB6论坛 » 求助!!!那位大虾指点一下
新手上路
Dim db as adodb.connection
Dim rs as adodb.recordset
Dim mitem as listitem
Set db = new adodb.connection
Set rs = new adodb.recordset
With db
.provider=”sqloledb”
.open “datasource=lab2; uid=sa;pwd=;initial catalog=northwind;”
End with
rs.open “select productname from products”, db,adopenstatic,adlockoptimistic
Do until re.eof
Set mitem=lvwproducts.listitems.add()
mitem.text=rs!productname
rs.movenext
Loop
lvwproducts是列表视图控件,上述代码不能正确运行,原因不可能是(选择一项)
a)
没有添加columnheaders
b)
Lvwproducts的listitems没有清空
c)
mitem.text=rs!productname错误,应该为mitem.text=rs.fields(“productname”).value
d)
listitem对象mitem没有用new关键字动态生成
查看详细资料
TOP
论坛元老
查看个人网站