帮忙看看VB TREEVIEW 的代码哪里有错? 它就是不显示
其中加载数据到DATASET用的是自己做的CLASS 用ds.getxml调用后可以肯定数据加载没有问题
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If Not Me.Page.IsPostBack Then
bindtree(TreeView1.Nodes, "0")
End If
End Sub
Private Sub bindtree(ByVal Nds As TreeNodeCollection, ByVal depid As String)
Param.Limpiar()
ds = obj.GolobalSolu1(StrkeyconnSolun1, Param.GeneraDocXML
("parametros"), "Tree_cargar")
Dim dv As DataView = New DataView()
dv.Table = ds.Tables(0)
Dim tn As TreeNode
Dim strid As String
Dim dr As DataRowView
For Each dr In dv
tn = New TreeNode()
tn.ID = dr("cod").GetType.ToString
tn.Text = dr("descripcion").GetType.ToString
Nds.Add(tn)
bindtree(tn.Nodes, tn.ID)
Next
End Sub
建立表代码如下,只是做一个小实验所以还比较简单
/*==============================================================*/
/* Database name: Tree */
/* DBMS name: Microsoft SQL Server 2000 */
/* Created on: 02-06-2005 14:26:18 */
/*==============================================================*/
if exists (select 1
from sysobjects
where id = object_id('TreePrueba')
and type = 'U')
drop table TreePrueba
go
/*==============================================================*/
/* Table: TreePrueba */
/*==============================================================*/
create table TreePrueba (
cod numeric not null,
"desc" varchar(50) null,
codant numeric null,
constraint PK_TREEPRUEBA primary key (cod)
)
go
问题点数:20、回复次数:4Top
1 楼qgqchile(qgq)回复于 2005-06-03 04:37:55 得分 0
补充一下 有一列的名字是descripcion 不是DESCTop
2 楼qgqchile(qgq)回复于 2005-06-03 04:55:14 得分 0
还忘记加一句
dv.RowFilter = "codant = cod"
编译不出错,可就是不显示那个树,急死拉 帮帮忙 谢了先Top
3 楼tihua(告诉我吧)回复于 2005-06-03 08:29:02 得分 0
路过Top
4 楼henrysap(henry)回复于 2005-06-04 15:12:04 得分 20
dv.RowFilter = "codant = 'cod'"
Top




