vb 至少一个参数值没有被指定,确定之后就会跳出“对象refresh的方法iadodc失败”这句话怎么解决 20
代码PrivateSubForm_Load()Adodc1.ConnectionString=cnn.ConnectionStringAdodc2.ConnectionS...
代码
Private Sub Form_Load()
Adodc1.ConnectionString = cnn.ConnectionString
Adodc2.ConnectionString = cnn.ConnectionString
Ado_temp.ConnectionString = cnn.ConnectionString
Adodc2.RecordSource = "select * from View_tsfl "
Adodc2.Refresh
Me.Left = (Screen.Width - Me.Width) / 2 '使用Screen对象获得屏幕的高度和宽度
Me.Top = (Screen.Height - Me.Height) / 2
Call Tree_change 'Call语句调用过程
End Sub
Public Sub Tree_change()
Dim Key, Text, BH As String
Dim Nod As Node
Key = "期刊分类"
Text = "期刊分类"
Set Node1 = TreeView1.Nodes.Add(, , Key, Text, 1) '设置TreeView1控件的节点 文本 和 图标(另外:1 为ImageList2控件图标的索引值)
Adodc1.RecordSource = "select * from lbtb "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Key = Trim(Adodc1.Recordset.Fields("期刊类别"))
Text = Adodc1.Recordset.Fields("期刊类别")
Set node2 = TreeView1.Nodes.Add(Node1.Index, tvwChild, Key, Text, 1) '设置TreeView1控件的节点 文本 和 图标(另外:1 为ImageList控件图标的索引值)
Adodc2.RecordSource = "select * from View_tsfl where 期刊类别='" + Adodc1.Recordset.Fields("期刊类别") + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst '将记录移动第一条
Do While Adodc2.Recordset.EOF = False '添加期刊名称
Key = Trim(Adodc2.Recordset.Fields("期刊名称"))
Text = Adodc2.Recordset.Fields("期刊名称")
'Set Node3 = TreeView1.Nodes.Add(node2.Index, tvwChild, Key, Text, 1) '设置TreeView1控件的节点 文本 和 图标(另外:1 为ImageList控件图标的索引值)
Adodc2.Recordset.MoveNext '将记录移动到下一条
Loop
End If
Adodc1.Recordset.MoveNext '将记录移动到下一条
Loop
End If
End Sub 展开
Private Sub Form_Load()
Adodc1.ConnectionString = cnn.ConnectionString
Adodc2.ConnectionString = cnn.ConnectionString
Ado_temp.ConnectionString = cnn.ConnectionString
Adodc2.RecordSource = "select * from View_tsfl "
Adodc2.Refresh
Me.Left = (Screen.Width - Me.Width) / 2 '使用Screen对象获得屏幕的高度和宽度
Me.Top = (Screen.Height - Me.Height) / 2
Call Tree_change 'Call语句调用过程
End Sub
Public Sub Tree_change()
Dim Key, Text, BH As String
Dim Nod As Node
Key = "期刊分类"
Text = "期刊分类"
Set Node1 = TreeView1.Nodes.Add(, , Key, Text, 1) '设置TreeView1控件的节点 文本 和 图标(另外:1 为ImageList2控件图标的索引值)
Adodc1.RecordSource = "select * from lbtb "
Adodc1.Refresh
If Adodc1.Recordset.RecordCount > 0 Then
Adodc1.Recordset.MoveFirst
Do While Adodc1.Recordset.EOF = False
Key = Trim(Adodc1.Recordset.Fields("期刊类别"))
Text = Adodc1.Recordset.Fields("期刊类别")
Set node2 = TreeView1.Nodes.Add(Node1.Index, tvwChild, Key, Text, 1) '设置TreeView1控件的节点 文本 和 图标(另外:1 为ImageList控件图标的索引值)
Adodc2.RecordSource = "select * from View_tsfl where 期刊类别='" + Adodc1.Recordset.Fields("期刊类别") + "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount > 0 Then
Adodc2.Recordset.MoveFirst '将记录移动第一条
Do While Adodc2.Recordset.EOF = False '添加期刊名称
Key = Trim(Adodc2.Recordset.Fields("期刊名称"))
Text = Adodc2.Recordset.Fields("期刊名称")
'Set Node3 = TreeView1.Nodes.Add(node2.Index, tvwChild, Key, Text, 1) '设置TreeView1控件的节点 文本 和 图标(另外:1 为ImageList控件图标的索引值)
Adodc2.Recordset.MoveNext '将记录移动到下一条
Loop
End If
Adodc1.Recordset.MoveNext '将记录移动到下一条
Loop
End If
End Sub 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询