1:窗口的AfterLod事件代码设为
Dim cmd As New SQLCommand
Dim dt As DataTable
cmd.CommandText = "SELECT DISTINCT 生产组,品名,配方分类 From {配方}"
dt = cmd.ExecuteReader()
Dim trv As WinForm.TreeView = e.Form.Controls("TreeView1")
trv.BuildTree(dt,"生产组|品名|配方分类")
trv.Nodes.Insert("加载所有数据",0)
2:目录树的NodeMouseDoubleClick事件设为:
Dim Filter As String
If e.Node.Text = "加载所有数据" Then
Filter = ""
Else
Dim Value() As String
Value = e.Node.FullPath.Split("\")
Select Case e.Node.Level
Case 0
Filter ="[生产组] = '" & Value(0) & "'"
Case 1
Filter ="[生产组] = '" & Value(0) & "' And [品名] = '" & Value(1) & "'"
Case 2
Filter ="[生产组] = '" & Value(0) & "' And [品名] = '" & Value(1) & "'And [配方分类] = '" & Value(2) & "'"
End Select
End If
DataTables("配方").LoadFilter = Filter
DataTables("配方").Load()
forms("配方录入").open()
上面的代码在使用内部数据表时一切正常,但是把内部数据表转换为外部数据表后,窗口的一起都正常,就是目录树不能加载数据,提示为窗口的AfterLod事件代码有误。
请大侠们帮我把需要修改的代码,修改后发表,我是菜鸟,说的太笼统我还是不明白的。恳求帮忙!!