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

📄 frmxinxi.frm

📁 一个学生宿舍加扣分的管理系统!内含添加宿舍...宿舍的加分建分..各宿舍的查询..兼数据库的备份与恢复
💻 FRM
字号:
VERSION 5.00
Object = "{5E9E78A0-531B-11CF-91F6-C2863C385E30}#1.0#0"; "MSFLXGRD.OCX"
Begin VB.Form frmxinxi 
   BackColor       =   &H00FFC0C0&
   Caption         =   "个人加减分情况查询"
   ClientHeight    =   9675
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   11145
   Icon            =   "frmxinxi.frx":0000
   LinkTopic       =   "Form1"
   ScaleHeight     =   9675
   ScaleWidth      =   11145
   Begin VB.CommandButton Command5 
      BackColor       =   &H00FFC0C0&
      Caption         =   "统计"
      Height          =   375
      Left            =   2520
      Style           =   1  'Graphical
      TabIndex        =   13
      Top             =   7680
      Width           =   1215
   End
   Begin VB.CommandButton Command4 
      BackColor       =   &H00FFC0C0&
      Caption         =   "删除"
      Height          =   375
      Left            =   6120
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   7680
      Width           =   1335
   End
   Begin VB.TextBox Text3 
      Height          =   615
      Left            =   1800
      TabIndex        =   11
      Top             =   1800
      Visible         =   0   'False
      Width           =   1815
   End
   Begin MSFlexGridLib.MSFlexGrid MSF2 
      Height          =   6375
      Left            =   5400
      TabIndex        =   10
      Top             =   840
      Width           =   5295
      _ExtentX        =   9340
      _ExtentY        =   11245
      _Version        =   393216
      BackColorFixed  =   16761024
      BackColorBkg    =   16761024
   End
   Begin VB.ComboBox Combo2 
      Height          =   300
      Left            =   4680
      TabIndex        =   9
      Top             =   240
      Width           =   1935
   End
   Begin VB.ComboBox Combo1 
      Height          =   300
      Left            =   1320
      TabIndex        =   8
      Top             =   240
      Width           =   2175
   End
   Begin VB.CommandButton Command3 
      BackColor       =   &H00FFC0C0&
      Caption         =   "退出"
      Height          =   375
      Left            =   7920
      Style           =   1  'Graphical
      TabIndex        =   7
      Top             =   7680
      Width           =   1335
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "查询"
      Height          =   375
      Left            =   7080
      Style           =   1  'Graphical
      TabIndex        =   6
      Top             =   240
      Width           =   1215
   End
   Begin VB.TextBox Text2 
      Height          =   375
      Left            =   4680
      TabIndex        =   5
      Text            =   "Text2"
      Top             =   240
      Width           =   2055
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "确定"
      Height          =   375
      Left            =   4320
      Style           =   1  'Graphical
      TabIndex        =   2
      Top             =   7680
      Width           =   1335
   End
   Begin MSFlexGridLib.MSFlexGrid MSF1 
      Height          =   6375
      Left            =   240
      TabIndex        =   1
      Top             =   840
      Width           =   5175
      _ExtentX        =   9128
      _ExtentY        =   11245
      _Version        =   393216
      BackColorFixed  =   16761024
      BackColorBkg    =   16761024
   End
   Begin VB.TextBox Text1 
      Height          =   375
      Left            =   1320
      TabIndex        =   0
      Text            =   "Text1"
      Top             =   240
      Width           =   2175
   End
   Begin VB.Label Label5 
      BackColor       =   &H00FFC0C0&
      Height          =   495
      Left            =   1920
      TabIndex        =   16
      Top             =   8160
      Width           =   2895
   End
   Begin VB.Label Label4 
      BackColor       =   &H00FFC0C0&
      Height          =   375
      Left            =   4920
      TabIndex        =   15
      Top             =   8640
      Width           =   4095
   End
   Begin VB.Label Label3 
      BackColor       =   &H00FFC0C0&
      Height          =   375
      Left            =   4920
      TabIndex        =   14
      Top             =   8160
      Width           =   4095
   End
   Begin VB.Label Label2 
      BackColor       =   &H00FFC0C0&
      Caption         =   "姓名:"
      Height          =   255
      Left            =   3840
      TabIndex        =   4
      Top             =   240
      Width           =   615
   End
   Begin VB.Label Label1 
      BackColor       =   &H00FFC0C0&
      Caption         =   "寝室号:"
      Height          =   375
      Left            =   480
      TabIndex        =   3
      Top             =   240
      Width           =   975
   End
End
Attribute VB_Name = "frmxinxi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public c As Integer         '临时存放取得的网格中的坐标
Public r As Integer
Public msf1fouse As Boolean '判断是对MSF1还是对MSF2操作
Public msf2fouse As Boolean
Public Sub showtitle1() '显示MSF1网格是中的标题

 MSF1.Clear
  Dim i As Integer
      Dim mrc As ADODB.Recordset
  With MSF1

    .Cols = 3
    .TextMatrix(0, 0) = "id"
    .TextMatrix(0, 1) = "加分分数"
    .TextMatrix(0, 2) = "加分内容"
  
    .ColWidth(0) = 1000
    .ColWidth(1) = 1500
    .ColWidth(2) = 2500
  
  
    .FixedRows = 1
  
    For i = 1 To Cols
      .ColAlignment(i) = 0
    Next i
    .FillStyle = flexFillSingle
    .Col = 0
    .Row = 0
    .RowSel = 1
    .ColSel = .Cols - 1
    .CellAlignment = 4
    .Row = 1
    End With
    End Sub
    Public Sub showtitle2() '显示MSF2网格是中的标题

 MSF2.Clear
  Dim i As Integer
      Dim mrc As ADODB.Recordset
  With MSF2

    .Cols = 3
    .TextMatrix(0, 0) = "id"
  
    .TextMatrix(0, 1) = "减分分数"
    .TextMatrix(0, 2) = "减分内容"
  
    .ColWidth(0) = 1000
    .ColWidth(1) = 1500
    .ColWidth(2) = 2500
    
    .FixedRows = 1
  
    For i = 1 To Cols
      .ColAlignment(i) = 0
    Next i
    .FillStyle = flexFillSingle
    .Col = 0
    .Row = 0
    .RowSel = 1
    .ColSel = .Cols - 1
    .CellAlignment = 4
    .Row = 1
    End With
    End Sub

    
  
  
Public Sub showdata1() '显示MSF1网格是内容
On Error GoTo s2
Dim i As Integer
Dim mrc As ADODB.Recordset
Set mrc = New ADODB.Recordset
Set mrc = ExecuteSQL(txtsql1)

 If mrc.EOF = False Then
   mrc.MoveFirst
  
   
   With MSF1
    .Rows = 2
    .Row = 1
   
    Do While Not mrc.EOF

     .Rows = .Rows + 1
     For i = 1 To 2
       .TextMatrix(.Row, i) = mrc.Fields(i + 1)
     Next i
     .TextMatrix(.Row, 0) = mrc.Fields(0)
      .Row = .Row + 1
     mrc.MoveNext
    
       
    Loop
 End With
 
 End If
 
  Set mrc = Nothing
  Exit Sub
s2:
 frmxinxi.MSF1.Refresh
End Sub
Public Sub showdata2() '显示MSF2网格是内容
On Error GoTo s2

Dim i As Integer
Dim mrc As ADODB.Recordset
Set mrc = New ADODB.Recordset
Set mrc = ExecuteSQL(txtsql2)

 If mrc.EOF = False Then
   mrc.MoveFirst
  
   
   With MSF2
    .Rows = 2
    .Row = 1
   
    Do While Not mrc.EOF
     
     .Rows = .Rows + 1
     For i = 1 To 2
       .TextMatrix(.Row, i) = mrc.Fields(i + 1)
     Next i
     .TextMatrix(.Row, 0) = mrc.Fields(0)
      .Row = .Row + 1
     mrc.MoveNext
   
    Loop
 End With
 
 End If
 
  Set mrc = Nothing
  Exit Sub
s2:
 frmxinxi.MSF2.Refresh
End Sub


Private Sub Combo1_DropDown() '找出所有寝室号
Combo1.Clear
Dim mrc As ADODB.Recordset
Set mrc = New ADODB.Recordset
Dim strsql As String
strsql = "select distinct 寝室号 from bedchamber"
Set mrc = ExecuteSQL(strsql)
 If mrc.EOF = False Then
 mrc.MoveFirst
 Do While Not mrc.EOF
 Combo1.AddItem mrc.Fields(0)
 mrc.MoveNext
 Loop
 End If

End Sub

Private Sub Combo2_DropDown() '找出相应寝室号中的所有成员
Combo2.Clear
strsql = "select distinct 姓名 from bedchamber where 寝室号=" & Trim(Combo1.Text) & ""
Set mrc = ExecuteSQL(strsql)
 If mrc.EOF = False Then
 mrc.MoveFirst
 Do While Not mrc.EOF
 Combo2.AddItem mrc.Fields(0)
 mrc.MoveNext
 Loop
 End If

End Sub

Private Sub Command1_Click()
Dim mrc As ADODB.Recordset
Set mrc = New ADODB.Recordset
If c = 0 Then
 sss = MsgBox("请选择你要修改的项 !", vbExclamation + vbOKOnly, "警告")
      Text3.Visible = False
      Exit Sub
      End If
  If c = 1 Then '加分分数的类型
  
     If Text3.Text = "" Or IsNumeric(Text3.Text) = False Then
      sss = MsgBox("加减分分数要为数值型且不能为空 !", vbExclamation + vbOKOnly, "警告")
      Text3.Visible = False
      Exit Sub
      End If
   End If

If msf1fouse = True Then
 
   strsql = "select * from addnum where autoid=" & Trim(frmxinxi.MSF1.TextMatrix(r, 0)) & ""
   Set mrc = ExecuteSQL(strsql)
   mrc.Fields(c + 1) = Trim(Text3.Text)
   mrc.Update
   MSF1.TextMatrix(r, c) = Text3.Text
         Text3.Text = ""
         Text3.Visible = False
         msf1fouse = False
   End If
  If msf2fouse = True Then
    
   strsql = "select * from subnum where autoid=" & Trim(frmxinxi.MSF2.TextMatrix(r, 0)) & ""
   Set mrc = ExecuteSQL(strsql)
   mrc.Fields(c + 1) = Trim(Text3.Text)
      mrc.Update
   MSF2.TextMatrix(r, c) = Text3.Text
         Text3.Text = ""
         Text3.Visible = False
         msf2fouse = False
    End If
End Sub

Private Sub Command2_Click() '查找信息
If Text1.Visible = True Then '判断是不是查找窗口

Text1.Visible = False
Text2.Visible = False
Combo1.Visible = True
Combo2.Visible = True
Else                    '是查找窗口则进行查找
 strsql = "select id from bedchamber where 寝室号=" & Trim(frmxinxi.Combo1.Text) & " and 姓名='" & Trim(frmxinxi.Combo2.Text) & "'"
     Set mrc = ExecuteSQL(strsql)
     id = mrc.Fields(0)
     txtsql1 = "select * from addnum where addnum.id=" & Trim(id) & "  order by addnum.autoid"
     txtsql2 = "select * from subnum where subnum.id=" & Trim(id) & "  order by subnum.autoid "
   frmxinxi.showtitle1
   frmxinxi.showdata1
   frmxinxi.showtitle2
   frmxinxi.showdata2
End If
End Sub

Private Sub Command3_Click()
Unload Me
frmdefault.Show

End Sub

Private Sub Command4_Click()

If msf1fouse = True Then
   If MSF1.TextMatrix(MSF1.Row, 0) = "" Then
    sss = MsgBox("请选择要删除的记录 !", vbExclamation + vbOKOnly, "警告")
    Exit Sub
    Else
     If MsgBox("确定要删除该条记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
   strsql = "delete from addnum where autoid=" & Trim(MSF1.TextMatrix(MSF1.Row, 0)) & ""
   ExecuteSQL (strsql)
   Else
   Exit Sub
   End If
   
   End If
Else
 If msf2fouse = True Then
  If MSF2.TextMatrix(MSF2.Row, 0) = "" Then
    sss = MsgBox("请选择要删除的记录 !", vbExclamation + vbOKOnly, "警告")
    Exit Sub
    Else
    If MsgBox("确定要删除该条记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
strsql = "delete from subnum where autoid=" & Trim(MSF2.TextMatrix(MSF2.Row, 0)) & ""
ExecuteSQL (strsql)
Else
   Exit Sub
   End If
End If
End If
End If
If frmxinxi.Text1.Visible = True Then
 strsql = "select id from bedchamber where 寝室号=" & Trim(frmxinxi.Text1.Text) & " and 姓名='" & Trim(frmxinxi.Text2.Text) & "'"
     Set mrc = ExecuteSQL(strsql)
     id = mrc.Fields(0)
     End If
 If frmxinxi.Combo1.Visible = True Then
     strsql = "select id from bedchamber where 寝室号=" & Trim(frmxinxi.Combo1.Text) & " and 姓名='" & Trim(frmxinxi.Combo2.Text) & "'"
     Set mrc = ExecuteSQL(strsql)
     id = mrc.Fields(0)
     End If
     txtsql1 = "select * from addnum where addnum.id=" & Trim(id) & "  order by addnum.autoid"
     txtsql2 = "select * from subnum where subnum.id=" & Trim(id) & "  order by subnum.autoid "
frmxinxi.showtitle1
frmxinxi.showdata1
frmxinxi.showtitle2
frmxinxi.showdata2

End Sub

Private Sub Command5_Click()
Dim mrc As ADODB.Recordset
Set mrc = New ADODB.Recordset
If frmxinxi.Text1.Visible = True Then
Label5.Caption = Trim(frmxinxi.Text1.Text) & "寝室的" & Trim(frmxinxi.Text2.Text) & "的情况为:"

 strsql = "select id from bedchamber where 寝室号=" & Trim(frmxinxi.Text1.Text) & " and 姓名='" & Trim(frmxinxi.Text2.Text) & "'"
     Set mrc = ExecuteSQL(strsql)
     id = mrc.Fields(0)
     End If
 If frmxinxi.Combo1.Visible = True Then
    Label5.Caption = Trim(frmxinxi.Combo1.Text) & "寝室的" & Trim(frmxinxi.Combo2.Text) & "的情况为:"

     strsql = "select id from bedchamber where 寝室号=" & Trim(frmxinxi.Combo1.Text) & " and 姓名='" & Trim(frmxinxi.Combo2.Text) & "'"
     Set mrc = ExecuteSQL(strsql)
     id = mrc.Fields(0)
     End If
 strsql = "select sum(加分分数) from addnum where id=" & Trim(id) & ""
     Set mrc = ExecuteSQL(strsql)
    Label3.Caption = "加分分数为:" & mrc.Fields(0) & "分"
     strsql = "select sum(减分分数) from subnum where id=" & Trim(id) & ""
     Set mrc = ExecuteSQL(strsql)
    Label4.Caption = "减分分数为:" & mrc.Fields(0) & "分"

  
End Sub

Private Sub Form_Load()
msf1fouse = False
msf2fouse = False
End Sub

Private Sub MSF1_Click()
msf1fouse = True
msf2fouse = False
Text3.Visible = False
End Sub

Private Sub MSF1_DblClick()
msf1fouse = True
msf2fouse = False
With MSF1
 If frmxinxi.MSF1.TextMatrix(.Row, 0) = "" Then
      sss = MsgBox("请选择你要修改的项 !", vbExclamation + vbOKOnly, "警告")
      Text3.Visible = False
      Exit Sub
   End If
r = .Row
c = .Col
Text3.Top = .Top + .RowPos(r) + 15
Text3.Left = .Left + .ColPos(c) + 25
Text3.Width = .ColWidth(c)
Text3.Height = .RowHeight(r) - 15
Text3.Text = .Text
    Text3.SelStart = 0
   Text3.SelLength = Len(Text3.Text)
Text3.Visible = True
Text3.SetFocus

End With

End Sub



Private Sub MSF2_Click()
msf2fouse = True
msf1fouse = False
Text3.Visible = False
End Sub

Private Sub MSF2_DblClick()
msf2fouse = True
msf1fouse = False

With MSF2
 If frmxinxi.MSF2.TextMatrix(.Row, 0) = "" Then
      sss = MsgBox("请选择你要修改的项 !", vbExclamation + vbOKOnly, "警告")
       Text3.Visible = False
      Exit Sub
   End If
r = .Row
c = .Col

 
Text3.Top = .Top + .RowPos(r) + 15
Text3.Left = .Left + .ColPos(c) + 25
Text3.Width = .ColWidth(c)
Text3.Height = .RowHeight(r) - 15
Text3.Text = .Text
    Text3.SelStart = 0
   Text3.SelLength = Len(Text3.Text)
Text3.Visible = True
Text3.SetFocus

End With

End Sub

⌨️ 快捷键说明

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