树反应数据库中字段时,ado不能连接
Private Sub Form_Load()Dim rs1 As New ADODB.Recordset
trvlb.LineStyle = tvwTreeLines
trvlb.ImageList = ImageList1
trvlb.Style = tvwTreelinesPlusMinusPictureText
Dim nodx As Node
rs1.Open "select * from lbmx where len(pk_lb)=2", cnn, adOpenKeyset, adLockOptimistic
If rs1.RecordCount > 0 Then
rs1.MoveFirst
Do While Not rs1.EOF
Set nodx = trvlb.Nodes.Add(, , rs1.Fields("pk_lb"), rs1.Fields("lbname"))
rs1.MoveNext
Loop
End If
txtfirnum.Text = rs1.RecordCount
End Sub
txtfirnum.Text 用于反应rs1的记录数,运行后显示-1
明明rs1的sql语句复制到sql 查询分析器中能够运行的。
所以不能把内容读到树的节点中,请高手指教,在下都蒙了
[ 本帖最后由 thjanxd 于 2012-3-28 08:21 编辑 ]