首页 > 数据库技术 > 详细

VB.net删除节点,数据库,文件

时间:2016-03-09 19:01:45      阅读:286      评论:0      收藏:0      [点我收藏+]

Private Sub mnuDel_Click()
‘删除节点
Dim sKey As String
‘Dim sFile As String
Dim oFS As FileSystemObject
Dim sPathFile As String
Dim sIndex As String
Dim sFlag As String
Set oFS = New FileSystemObject
On Error Resume Next
If MsgBox("确定要删除此类别[" & TreeView1.SelectedItem.Text & "]", vbYesNo, "静态信息") = vbYes Then
    sKey = TreeView1.SelectedItem.Key
    sIndex = TreeView1.SelectedItem.Index
‘    sFile = sContentPath & sKey & "*" & ".htm"
‘    sFlag = Check(sIndex)
    sFlag = Len(sKey) - 1
    If RemoveInfo(sKey) Then
        TreeView1.Nodes.Remove TreeView1.SelectedItem.Index
        sPathFile = Dir(sContentPath)
        While (sPathFile <> "")
            If Mid(sPathFile, 2, sFlag) = Right(sKey, Len(sKey) - 1) Then
‘                oFS.DeleteFile sPathFile, True
                Kill sContentPath & sPathFile
            End If
            sPathFile = Dir
        Wend
        If TreeView1.SelectedItem.Children = 0 Then
           TreeView1.SelectedItem.Image = "closed"
        End If
    End If
End If
End Sub

 

 

Private Function RemoveInfo(sSearch As String) As Boolean
Dim sSQL As String
Dim objDataAccess As clsDataAccess
RemoveInfo = False
On Error GoTo errHandle
‘    sSQL = "Delete From BCCB_Info Where Id=" & Right(sSearch, Len(sSearch) - 1)
    sSQL = "Delete From BCCB_Info Where Id like ‘" & Right(sSearch, Len(sSearch) - 1) & "%‘"
    Set objDataAccess = New clsDataAccess
    If objDataAccess.ExecSQL(sSQL) Then RemoveInfo = True
   
    Set objDataAccess = Nothing
Exit Function
errHandle:
    RemoveInfo = False
    Call WriteLog(DEBUG_LEVEL, "frmBCCBInfo.RemoveInfo Error" & err.Description)
    Set objDataAccess = Nothing
End Function

VB.net删除节点,数据库,文件

原文:http://www.cnblogs.com/gyc19920704/p/5259264.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!