www.pudn.com > vb-sql-server.rar > frmWZLBS.frm, change:2003-06-17,size:6649b


VERSION 5.00 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "Mscomctl.ocx" 
Begin VB.Form frmWZLBS  
   Caption         =   "选择产品类型" 
   ClientHeight    =   4500 
   ClientLeft      =   1260 
   ClientTop       =   1956 
   ClientWidth     =   7248 
   LinkTopic       =   "Form1" 
   ScaleHeight     =   4500 
   ScaleWidth      =   7248 
   Begin VB.CommandButton cmdDelete  
      Caption         =   "删除类" 
      Height          =   375 
      Left            =   5760 
      TabIndex        =   5 
      Top             =   1800 
      Width           =   1215 
   End 
   Begin VB.CommandButton cmdCancel  
      Caption         =   "取消" 
      Height          =   375 
      Left            =   5760 
      TabIndex        =   4 
      Top             =   3000 
      Width           =   1215 
   End 
   Begin VB.CommandButton cmdEnter  
      Caption         =   "确定" 
      Height          =   375 
      Left            =   5760 
      TabIndex        =   3 
      Top             =   2400 
      Width           =   1215 
   End 
   Begin VB.CommandButton cmdADDP  
      Caption         =   "添加父类" 
      Height          =   375 
      Left            =   5760 
      TabIndex        =   2 
      Top             =   600 
      Width           =   1215 
   End 
   Begin VB.CommandButton cmdADDC  
      Caption         =   "添加子类" 
      Height          =   375 
      Left            =   5760 
      TabIndex        =   1 
      Top             =   1200 
      Width           =   1215 
   End 
   Begin MSComctlLib.TreeView TreeView1  
      Height          =   3735 
      Left            =   120 
      TabIndex        =   0 
      Top             =   600 
      Width           =   5295 
      _ExtentX        =   9335 
      _ExtentY        =   6583 
      _Version        =   393217 
      LineStyle       =   1 
      Style           =   6 
      BorderStyle     =   1 
      Appearance      =   0 
      MousePointer    =   1 
   End 
   Begin VB.Label Label1  
      Caption         =   "选择指定类别并确定,鼠标选定可以修改类别内容。" 
      Height          =   375 
      Left            =   240 
      TabIndex        =   6 
      Top             =   120 
      Width           =   4335 
   End 
End 
Attribute VB_Name = "frmWZLBS" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
Dim parText As String 
Private Sub cmdADDC_Click() 
    Dim nodX As Node 
    If Trim(parText) <> "" Then 
        If TreeView1.Nodes(parText).Parent Is Nothing Then 
            Set nodX = TreeView1.Nodes.Add(parText, tvwChild) 
            nodX.Key = GetRkno() 
            nodX.Text = "新建类(点击鼠标修改)" 
            nodX.EnsureVisible 
        Else 
            MsgBox "不能添加第三层次类别,土鳖!!!", vbOKOnly, "警告" 
        End If 
    End If 
     
End Sub 
 
Private Sub cmdADDP_Click() 
        Set nodX = TreeView1.Nodes.Add(, tvwChild) 
        nodX.Key = GetRkno() 
        nodX.Text = "新建类(点击鼠标修改)" 
 
End Sub 
 
Private Sub cmdCancel_Click() 
    Unload Me 
End Sub 
 
Private Sub cmdDelete_Click() 
    Dim nodX As Node 
    Dim txtSQL As String 
    Dim MsgText As String 
    Dim mrc As ADODB.Recordset 
     
    If Trim(parText) <> "" Then 
        With TreeView1 
     
            If MsgBox("是否删除" & .Nodes(parText).Text & "?", vbOKCancel, "警告") = vbOK Then 
                txtSQL = "delete from dm_wzlb where lbcode1 = '" & Trim(.Nodes(parText).Key) & "'" 
                Set mrc = ExecuteSQL(txtSQL, MsgText) 
                 
                If .Nodes(parText).Parent Is Nothing Then 
                    txtSQL = "delete from dm_wzlb where lbcode = '" & Trim(.Nodes(parText).Key) & "'" 
                    Set mrc = ExecuteSQL(txtSQL, MsgText) 
                End If 
                 
                TreeView1.Nodes.Clear 
                 
                ShowClass 
            Else 
                Exit Sub 
            End If 
        End With 
    End If 
     
End Sub 
 
Private Sub cmdEnter_Click() 
    If Not Trim(parText) = "" Then 
        If TreeView1.Nodes(parText).Parent Is Nothing Then 
            MsgBox "请选择第二层次类别!", vbOKOnly, "警告" 
            Exit Sub 
        Else 
            frmWZSetup1.txtItem(10) = Trim(TreeView1.Nodes(parText).Text) 
            frmWZSetup1.txtItem(9) = Trim(parText) 
            Unload Me 
 
        End If 
    End If 
End Sub 
 
Private Sub Form_Load() 
 
    ShowClass 
     
End Sub 
 
Private Sub TreeView1_AfterLabelEdit(Cancel As Integer, NewString As String) 
    Dim txtSQL As String 
    Dim MsgText As String 
    Dim mrc As ADODB.Recordset 
     
    TreeView1.Nodes(parText).Text = NewString 
         
    txtSQL = "select * from dm_wzlb where lbcode1 = '" & Trim(TreeView1.Nodes(parText).Key) & "'" 
    Set mrc = ExecuteSQL(txtSQL, MsgText) 
    If Not mrc.EOF Then 
            mrc.Fields(3) = NewString 
            mrc.Update 
            mrc.Close 
    Else 
        If TreeView1.Nodes(parText).Parent Is Nothing Then 
            txtSQL = "insert dm_wzlb (lbcode,lb,lbcode1,lb1) values ('r','root','" & Trim(TreeView1.Nodes(parText).Key) & "','" & Trim(NewString) & "')" 
            Set mrc = ExecuteSQL(txtSQL, MsgText) 
        Else 
            txtSQL = "insert dm_wzlb (lbcode,lb,lbcode1,lb1) values ('" & Trim(TreeView1.Nodes(parText).Parent.Key) & "','" & Trim(TreeView1.Nodes(parText).Parent.Text) & "','" & Trim(TreeView1.Nodes(parText).Key) & " ','" & Trim(NewString) & "')" 
            Set mrc = ExecuteSQL(txtSQL, MsgText) 
        End If 
    End If 
     
End Sub 
 
Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node) 
    parText = Node.Key 
End Sub 
Private Sub ShowClass() 
    Dim txtSQL As String 
    Dim MsgText As String 
    Dim mrc As ADODB.Recordset 
     
    txtSQL = "select lbcode1,lb1 from dm_wzlb where lbcode = 'r'" 
    Set mrc = ExecuteSQL(txtSQL, MsgText) 
     
    If Not mrc.EOF Then 
        Do While Not mrc.EOF 
            Set nodX = TreeView1.Nodes.Add(, tvwChild) 
            nodX.Key = Trim(mrc.Fields(0)) 
            nodX.Text = Trim(mrc.Fields(1)) 
            mrc.MoveNext 
        Loop 
        mrc.Close 
    End If 
     
    txtSQL = "select * from dm_wzlb where lbcode <> 'r'" 
    Set mrc = ExecuteSQL(txtSQL, MsgText) 
     
    If Not mrc.EOF Then 
        Do While Not mrc.EOF 
            Set nodX = TreeView1.Nodes.Add(Trim(mrc.Fields(0)), tvwChild) 
            nodX.Key = mrc.Fields(2) 
            nodX.Text = mrc.Fields(3) 
            mrc.MoveNext 
             
        Loop 
    End If 
End Sub