高分求vb的treeview实例,要求绑定数据库的.最好是SQL,顺便问两个小问题:
1,创建存储过程之后怎么调用,有简单代码是好(新手)
2,怎么删除上传的文件,比如在upload\word.doc文件,file.delete好像不行!
问题多了.分不够再加!

解决方案 »

  1.   

    http://www.pcdog.com/p/html/200515/5120057154_1.htm
      

  2.   

    没有现成的实例普通用法,加这一句:
    com.CommandType = CommandType.StoredProceduredelete:是不是取得的路径有问题
      

  3.   

    呵呵.我只想研究一下简单的代码,存储过程现在我已经整出来了..现在主机还有treeview,VS.NET2005自带有treeview不用下载啊..但我为什么调用出来第二次就不能用呢?
      

  4.   

    为了速度缓存DataTable        Public Function GetTreeTable() As DataTable                Dim dt As New DataTable()                dt = HttpContext.Current.Cache("Treeview")                If dt Is Nothing Then                    Dim Conn As New SqlConnection                    Dim clsConnDatabase As New ConnectionDatabase                    Conn = clsConnDatabase.ConnDatabase                     Dim Command As New SqlCommand                    Command.Connection = Conn                    Command.CommandText = "GetTreeview"                    Command.CommandType = CommandType.StoredProcedure                    Command.ExecuteNonQuery()                     Dim da As New SqlDataAdapter(Command)                    dt = New DataTable()                    da.Fill(dt)                    HttpContext.Current.Cache.Insert("Treeview", dt)                End If                Return dt            End Function 这里是主要阿Public Sub PopulateNodes(ByVal nodes As TreeNodeCollection, Optional ByVal intParentID As Int32 = 0)                Dim dt As New DataTable()                dt = clsWebForms.GetTreeTable()                Dim strExpression As StringstrExpression = "[parentID] = " & intParentID                Dim foundRows() As DataRow                foundRows = dt.Select(strExpression)                 Dim I As Integer                For I = 0 To foundRows.GetUpperBound(0)                    Dim tn As New TreeNode()                    tn.Text = foundRows(I).Item(“TableName”).ToString()                    tn.Value = foundRows(I).Item("ID").ToString()                    Dim dr() As DataRow                    dr = dt.Select("[parentID] = " & tn.Value)                    If dr.GetUpperBound(0) > -1 Then                        tn.PopulateOnDemand = True                    End If                    nodes.Add(tn)                Next            End Sub 建立WebForm 放入Treeview    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load        If Not Page.IsPostBack Then    PopulateNodes(TreeView1.Nodes, 0)        End If    End Sub     Protected Sub TreeView1_TreeNodePopulate(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.TreeNodeEventArgs) Handles TreeView1.TreeNodePopulate                PopulateNodes(e.Node.ChildNodes, e.Node.Value)    End Sub
      

  5.   

    http://dev.csdn.net/author/shadowsky/231d27652a414acba8e0e03260ad4339.html
      

  6.   

    谢谢,我现在有点怕.因为我怕treeview拉到页面上来.第二次就打不开.说加载失败!
      

  7.   

    Dim clsConnDatabase As New ConnectionDatabase 
     dt = clsWebForms.GetTreeTable()
    这两句什么意思!我的还是不行哦!
      

  8.   

    cctaiyang(带头大哥_OPPA) 
    大哥.进来看看.VB的人好少..就看你了!