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

📄 frmdeviceaccount.frm

📁 网路设备资产管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX"
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form FrmDeviceAccount 
   Caption         =   "设备清单"
   ClientHeight    =   7245
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   10755
   Icon            =   "FrmDeviceAccount.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   ScaleHeight     =   7245
   ScaleWidth      =   10755
   StartUpPosition =   2  '屏幕中心
   Begin MSComctlLib.Toolbar Toolbar1 
      Height          =   780
      Left            =   0
      TabIndex        =   0
      Top             =   0
      Width           =   9495
      _ExtentX        =   16748
      _ExtentY        =   1376
      ButtonWidth     =   1032
      ButtonHeight    =   1376
      Style           =   1
      ImageList       =   "ImageList1"
      _Version        =   393216
      BeginProperty Buttons {66833FE8-8583-11D1-B16A-00C0F0283628} 
         NumButtons      =   1
         BeginProperty Button1 {66833FEA-8583-11D1-B16A-00C0F0283628} 
            Caption         =   "关闭"
            Key             =   "关闭"
            ImageIndex      =   4
         EndProperty
      EndProperty
      Begin MSComctlLib.ImageList ImageList1 
         Left            =   4680
         Top             =   120
         _ExtentX        =   1005
         _ExtentY        =   1005
         BackColor       =   -2147483643
         ImageWidth      =   32
         ImageHeight     =   32
         MaskColor       =   12632256
         _Version        =   393216
         BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628} 
            NumListImages   =   4
            BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "FrmDeviceAccount.frx":08CA
               Key             =   ""
            EndProperty
            BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "FrmDeviceAccount.frx":11A4
               Key             =   ""
            EndProperty
            BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "FrmDeviceAccount.frx":1A7E
               Key             =   ""
            EndProperty
            BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628} 
               Picture         =   "FrmDeviceAccount.frx":2358
               Key             =   ""
            EndProperty
         EndProperty
      End
   End
   Begin MSFlexGridLib.MSFlexGrid MSFlexGrid1 
      Height          =   6015
      Left            =   120
      TabIndex        =   1
      Top             =   1200
      Width           =   10575
      _ExtentX        =   18653
      _ExtentY        =   10610
      _Version        =   393216
      RowHeightMin    =   315
      WordWrap        =   -1  'True
      HighLight       =   0
      FillStyle       =   1
      AllowUserResizing=   1
   End
   Begin VB.Label Label1 
      Caption         =   "设备编号规则及数量统计表"
      Height          =   255
      Left            =   3960
      TabIndex        =   2
      Top             =   960
      Width           =   2775
   End
End
Attribute VB_Name = "FrmDeviceAccount"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'****************************************************************************
'人人为我,我为人人
'枕善居收藏整理
'发布日期:2007/09/25
'描    述:江苏大学网络信息中心网络管理系统 - v1.0 Beta
'网    站:http://www.Mndsoft.com/  (VB6源码博客)
'网    站:http://www.VbDnet.com/   (VB.NET源码博客,主要基于.NET2005)
'e-mail  :Mndsoft@163.com
'e-mail  :Mndsoft@126.com
'OICQ    :88382850
'          如果您有新的好的代码别忘记给枕善居哦!
'****************************************************************************

Dim txtSQL As String
Dim MsgText As String
Dim HasError As Boolean

Private WithEvents mMSFlexGrid1 As cFlexGridBinder
Attribute mMSFlexGrid1.VB_VarHelpID = -1

Private Sub Form_Load()
Grid_Init
Grid_Fill
End Sub

Sub Grid_Init()

    With MSFlexGrid1
        .FormatString = "|<字段|<位数|<编号|<名称|<数量|<最小编号|<最大编号"
        .ColWidth(0) = 0
        .ColWidth(1) = 800
        .ColWidth(2) = 800
        .ColWidth(3) = 800
        .ColWidth(4) = 2500
        .ColWidth(5) = 1500
        .ColWidth(6) = 1500
        .ColWidth(7) = 1500
        .Rows = 1

    End With
    
    Set mMSFlexGrid1 = New cFlexGridBinder
    With mMSFlexGrid1
        Set .Grid = MSFlexGrid1
        
        .Editable = True
        .EditOnMouse = emeNone

        .FullRowSelect = True
        
    End With

End Sub


Sub Grid_Fill()


        
        
Dim rst As ADODB.Recordset
Dim rst2 As ADODB.Recordset
Dim rst3 As ADODB.Recordset



'第一步 ,按设备类型统计

MSFlexGrid1.AddItem vbTab & "类型" & vbTab & "一位"
txtSQL = "select * from tbl_devicetype"
Set rst = ExecuteSQL(txtSQL, MsgText, HasError)

  
    
    Do While Not rst.EOF
    
       txtSQL = "select count(*) count from tbl_device where type_id = '" & rst.Fields("type_id") & "'"
       Set rst2 = ExecuteSQL(txtSQL, MsgText, HasError)

       txtSQL = "select min(netcenter_id) min,max(netcenter_id) max from tbl_device where type_id = '" & rst.Fields("type_id") & "'"
       Set rst3 = ExecuteSQL(txtSQL, MsgText, HasError)
    
        MSFlexGrid1.AddItem vbTab _
        & "" & vbTab _
        & "" & vbTab _
        & rst.Fields("type_id") & vbTab _
        & rst.Fields("type_name") & vbTab _
        & rst2.Fields("count") & vbTab _
        & rst3.Fields("min") & vbTab _
        & rst3.Fields("max")
    rst.MoveNext
    Loop
    
'第二步 ,按厂商统计
MSFlexGrid1.AddItem vbTab & "厂商" & vbTab & "两位"
txtSQL = "select * from tbl_manufacturer"
Set rst = ExecuteSQL(txtSQL, MsgText, HasError)

  
    
    Do While Not rst.EOF
    
       txtSQL = "select count(*) count from tbl_device where manufacturer_id = '" & rst.Fields("manufacturer_id") & "'"
       Set rst2 = ExecuteSQL(txtSQL, MsgText, HasError)

       txtSQL = "select min(netcenter_id) min,max(netcenter_id) max from tbl_device where manufacturer_id = '" & rst.Fields("manufacturer_id") & "'"
       Set rst3 = ExecuteSQL(txtSQL, MsgText, HasError)
    
        MSFlexGrid1.AddItem vbTab _
        & "" & vbTab _
        & "" & vbTab _
        & rst.Fields("manufacturer_id") & vbTab _
        & rst.Fields("manufacturer_name") & vbTab _
        & rst2.Fields("count") & vbTab _
        & rst3.Fields("min") & vbTab _
        & rst3.Fields("max")
    rst.MoveNext
    Loop
    

'第三步 ,按型号统计
MSFlexGrid1.AddItem vbTab & "型号" & vbTab & "两位"
txtSQL = "select * from tbl_model"
Set rst = ExecuteSQL(txtSQL, MsgText, HasError)

  
    
    Do While Not rst.EOF
    
       txtSQL = "select count(*) count from tbl_device where model_id = '" & rst.Fields("model_id") & "'"
       Set rst2 = ExecuteSQL(txtSQL, MsgText, HasError)

       txtSQL = "select min(netcenter_id) min,max(netcenter_id) max from tbl_device where model_id = '" & rst.Fields("model_id") & "'"
       Set rst3 = ExecuteSQL(txtSQL, MsgText, HasError)
    
        MSFlexGrid1.AddItem vbTab _
        & "" & vbTab _
        & "" & vbTab _
        & rst.Fields("model_id") & vbTab _
        & rst.Fields("manufacturer_name") & rst.Fields("model_name") & vbTab _
        & rst2.Fields("count") & vbTab _
        & rst3.Fields("min") & vbTab _
        & rst3.Fields("max")
    rst.MoveNext
    Loop
    
'第四步 ,总计

txtSQL = "select count(*) count from tbl_device"
Set rst2 = ExecuteSQL(txtSQL, MsgText, HasError)

 MSFlexGrid1.AddItem vbTab & "总计" & vbTab & vbTab & vbTab & vbTab & rst2.Fields("count")
    

    
End Sub

Private Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button)
    On Error Resume Next
    Select Case Button.key

        Case "关闭"
          Unload Me
          
    End Select
End Sub



⌨️ 快捷键说明

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