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

📄 form2.frm

📁 可进行学校或培训单位上机的自动日志管理跟踪,省去了手工填写日志
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form2 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "学生数据"
   ClientHeight    =   6660
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   9180
   Icon            =   "Form2.frx":0000
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   6660
   ScaleWidth      =   9180
   Begin VB.CommandButton Command5 
      Caption         =   "显示全部记录"
      Height          =   495
      Left            =   360
      TabIndex        =   8
      Top             =   4800
      Width           =   1455
   End
   Begin MSAdodcLib.Adodc Adodc1 
      Align           =   2  'Align Bottom
      Height          =   330
      Left            =   0
      Top             =   6330
      Visible         =   0   'False
      Width           =   9180
      _ExtentX        =   16193
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   ""
      OLEDBString     =   ""
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin MSDataGridLib.DataGrid DataGrid1 
      Bindings        =   "Form2.frx":08CA
      Height          =   6615
      Left            =   2160
      TabIndex        =   7
      Top             =   0
      Width           =   6975
      _ExtentX        =   12303
      _ExtentY        =   11668
      _Version        =   393216
      AllowUpdate     =   -1  'True
      HeadLines       =   1
      RowHeight       =   17
      AllowAddNew     =   -1  'True
      BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   11.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ColumnCount     =   2
      BeginProperty Column00 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      BeginProperty Column01 
         DataField       =   ""
         Caption         =   ""
         BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED} 
            Type            =   0
            Format          =   ""
            HaveTrueFalseNull=   0
            FirstDayOfWeek  =   0
            FirstWeekOfYear =   0
            LCID            =   2052
            SubFormatType   =   0
         EndProperty
      EndProperty
      SplitCount      =   1
      BeginProperty Split0 
         BeginProperty Column00 
         EndProperty
         BeginProperty Column01 
         EndProperty
      EndProperty
   End
   Begin VB.Frame Frame1 
      Caption         =   "工具栏"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   14.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   6615
      Left            =   120
      TabIndex        =   0
      Top             =   0
      Width           =   1935
      Begin VB.CommandButton Command4 
         Caption         =   "退    出"
         Height          =   495
         Left            =   240
         TabIndex        =   6
         Top             =   5880
         Width           =   1455
      End
      Begin VB.TextBox Text1 
         Height          =   375
         Left            =   120
         TabIndex        =   5
         Top             =   3840
         Width           =   1695
      End
      Begin VB.ComboBox Combo1 
         Height          =   300
         Left            =   120
         TabIndex        =   4
         Text            =   "姓名"
         Top             =   3360
         Width           =   1695
      End
      Begin VB.CommandButton Command3 
         Caption         =   "查    找"
         Height          =   495
         Left            =   240
         TabIndex        =   3
         Top             =   2640
         Width           =   1455
      End
      Begin VB.CommandButton Command2 
         Caption         =   "删 除 记 录"
         Height          =   495
         Left            =   240
         TabIndex        =   2
         Top             =   1560
         Width           =   1455
      End
      Begin VB.CommandButton Command1 
         Caption         =   "定位到末记录"
         Height          =   495
         Left            =   240
         TabIndex        =   1
         Top             =   480
         Width           =   1455
      End
   End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Combo1_KeyPress(KeyAscii As Integer)
On Error Resume Next
KeyAscii = 0
End Sub

Private Sub Command1_Click()
 If Adodc1.Recordset.RecordCount > 0 Then
     Adodc1.Recordset.MoveLast
 End If
End Sub

Private Sub Command2_Click()
  If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then
     'On Error Resume Next
     a = MsgBox("你确定要删除数据吗?", vbYesNo, "提示")
     If a = vbYes Then
       Adodc1.Recordset.Delete
       DataGrid1.SetFocus
     End If
End If
End Sub

Private Sub Command3_Click()
 If Trim(Combo1.Text = "") Then
    MsgBox "请选择查找字段!", vbOKOnly, "信息提示"
    Combo1.SetFocus
 Else
    Select Case Trim(Combo1.Text)
           Case "班级"
               fieldss = "bj"
           Case "姓名"
               fieldss = "xm"
           Case "学号"
               fieldss = "xh"
    End Select
    On Error Resume Next
    If fieldss <> "xh" Then
      Adodc1.Recordset.Filter = "[" & fieldss & "] like '*" & Trim(Text1.Text) & "*'"
    Else
      Adodc1.Recordset.Filter = "[" & fieldss & "] = " & Val(Trim(Text1.Text))
    End If
 End If
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Command5_Click()
 Call connecta
End Sub

Private Sub DataGrid1_HeadClick(ByVal ColIndex As Integer)
  Select Case ColIndex
         Case 0
              If clickflg = False Then
                Adodc1.Recordset.Sort = "bj asc"
                clickflg = True
              Else
                Adodc1.Recordset.Sort = "bj desc"
                clickflg = False
              End If
         Case 1
              If clickflg = False Then
                Adodc1.Recordset.Sort = "xm asc"
                clickflg = True
              Else
                Adodc1.Recordset.Sort = "xm desc"
                clickflg = False
              End If
         Case 2
              If clickflg = False Then
                Adodc1.Recordset.Sort = "pwd asc"
                clickflg = True
              Else
                Adodc1.Recordset.Sort = "pwd desc"
                clickflg = False
              End If
         Case 3
              If clickflg = False Then
                Adodc1.Recordset.Sort = "xh asc"
                clickflg = True
              Else
                Adodc1.Recordset.Sort = "xh desc"
                clickflg = False
              End If
   End Select
End Sub

Private Sub Form_Activate()
 DataGrid1.SetFocus
End Sub

Private Sub Form_Load()
 Form2.Move (Screen.Width - Form2.Width) / 2, (Screen.Height - Form2.Height) / 2
 Combo1.AddItem "班级"
 Combo1.AddItem "姓名"
 Combo1.AddItem "学号"
 Call connecta
 
End Sub
Private Sub connecta()
    Adodc1.ConnectionString = connstr '"provider=microsoft.jet.oledb.4.0; jet oledb:database password=office;data source=" & App.Path & "\msshuju.ocx"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = "select bj,xm,pwd,xh from student order by bj asc,xm asc"
    Adodc1.Refresh
    'Adodc1.Recordset.Sort = "bj"
    Set DataGrid1.DataSource = Adodc1
    DataGrid1.Columns(0).Caption = "班 级"
    DataGrid1.Columns(1).Caption = "姓 名"
    DataGrid1.Columns(2).Caption = "密 码"
    DataGrid1.Columns(3).Caption = "学 号"
End Sub

⌨️ 快捷键说明

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