⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmbooksort.frm

📁 在线图书馆系统 包括VB程序设计的后台与ASP的网页
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Begin VB.Form FrmBookSort 
   Caption         =   "图书类别选择"
   ClientHeight    =   6870
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   4320
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   ScaleHeight     =   6870
   ScaleWidth      =   4320
   StartUpPosition =   2  '屏幕中心
   Begin VB.CommandButton CmdCancel 
      Caption         =   "取消"
      Height          =   495
      Left            =   2400
      TabIndex        =   2
      Top             =   6120
      Width           =   1095
   End
   Begin VB.CommandButton CmdOk 
      Caption         =   "确定"
      Height          =   495
      Left            =   840
      TabIndex        =   1
      Top             =   6120
      Width           =   1095
   End
   Begin MSComctlLib.ImageList ImageList1 
      Left            =   120
      Top             =   6600
      _ExtentX        =   1005
      _ExtentY        =   1005
      BackColor       =   -2147483643
      ImageWidth      =   16
      ImageHeight     =   16
      MaskColor       =   12632256
      _Version        =   393216
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
         NumListImages   =   3
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmBookSort.frx":0000
            Key             =   ""
         EndProperty
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmBookSort.frx":0CDA
            Key             =   ""
         EndProperty
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
            Picture         =   "FrmBookSort.frx":19B4
            Key             =   ""
         EndProperty
      EndProperty
   End
   Begin MSComctlLib.TreeView TreeView1 
      Height          =   5535
      Left            =   360
      TabIndex        =   0
      Top             =   360
      Width           =   3615
      _ExtentX        =   6376
      _ExtentY        =   9763
      _Version        =   393217
      Style           =   7
      Appearance      =   1
   End
End
Attribute VB_Name = "FrmBookSort"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim i As Integer
Dim J As Integer
Dim nodx As Node
Dim CunZai As Boolean '定义变量
Dim Conn As New ADODB.Connection
Dim AdoRs As New ADODB.Recordset



Private Sub CmdExit_Click()
    End '退出程序
End Sub

Private Sub CmdFold_Click()
    For i = 1 To TreeView1.Nodes.Count
        TreeView1.Nodes(i).Expanded = False '收起所有节点
    Next i
End Sub

Private Sub CmdCancel_Click()
    Unload Me
End Sub

Private Sub CmdOK_Click()
   
    Dim AdoRs1 As New ADODB.Recordset
    Dim i As Long
    Dim SortId As String
    SortId = TreeView1.SelectedItem.Key
    '查本类书上次最大ID
    AdoRs1.Open "select MID=max(id) from bookproperties where id like '" & SortId & "%'", Conn, adOpenKeyset
    '算本次ID
    If Not IsNull(AdoRs1!Mid) Then
        i = Val(Right(AdoRs1!Mid, Len(AdoRs1!Mid) - Len(SortId))) + 1
    Else
        i = 1
    End If
    If SF Then
        FrmBookmanage.txtSort = SortId
        FrmBookmanage.txtID = SortId + Trim(Str(i))
    Else
        FrmBookmanage.TxtSort1 = SortId
    End If
    Unload Me
End Sub

Private Sub Form_Load()
   TreeView1.LineStyle = tvwTreeLines '在兄弟节点和父节点之间显示线
   TreeView1.ImageList = ImageList1 '链接图像列
  TreeView1.Style = tvwTreelinesPlusMinusPictureText
   '树状外观包含全部元素
   Dim i As Integer
    ConnString = "Driver={SQLServer};Server=(local);UID=DLuser;PWD=;Database=DigitalLibrary"

    Conn.Provider = "sqloledb"
    Conn.ConnectionString = ConnString
    Conn.Open
    AdoRs.Open "select * from  BookSort where datalength(sortcode)=1", Conn, adOpenKeyset
    Do While Not AdoRs.EOF
        ' 建立名称为AdoRs!SortName的父节点,选择索引为1的图像
        Set nodx = TreeView1.Nodes.Add(, , AdoRs!SortCode, AdoRs!SortName, 1)
        AdoRs.MoveNext
    Loop
    AdoRs.Close
    AdoRs.Open "select * from  BookSort where datalength(sortcode)=2", Conn, adOpenKeyset
    Do While Not AdoRs.EOF
        CunZai = False
        For i = 1 To TreeView1.Nodes.Count '检查新输入的父节点名称是否存在
            If Left(AdoRs!SortCode, 1) = TreeView1.Nodes(i).Key Then
                CunZai = True
                Exit For
            End If
        Next i
        If CunZai = True Then '若存在, 则在父节点下建立子节点
          Set nodx = TreeView1.Nodes.Add(Left(AdoRs!SortCode, 1), tvwChild, AdoRs!SortCode, AdoRs!SortName, 1)
        End If
        AdoRs.MoveNext
    Loop
    AdoRs.Close
End Sub

Private Sub TreeView1_Expand(ByVal Node As MSComctlLib.Node)
  Node.ExpandedImage = 2 '节点被展开时,选择索引为2的图像
End Sub

Private Sub TreeView1_NodeClick(ByVal Node As MSComctlLib.Node)
  If TreeView1.SelectedItem.Children = 0 Then '检查是否有子节点,0为无
    For i = 1 To TreeView1.Nodes.Count
    If TreeView1.Nodes(i).Selected Then
       'MsgBox "您选择的是:“" & TreeView1.Nodes(I).FullPath & "”子节点!"
       '系统提示
    End If
    Next i
  End If
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -