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

📄 frmchangeroom.frm

📁 公寓管理信息系统的基本功能的设计~~~~~~~~
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Width           =   2055
      End
      Begin MSDataGridLib.DataGrid DataGrid2 
         Height          =   1215
         Left            =   240
         TabIndex        =   10
         Top             =   1920
         Width           =   6735
         _ExtentX        =   11880
         _ExtentY        =   2143
         _Version        =   393216
         HeadLines       =   1
         RowHeight       =   15
         BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
            Name            =   "宋体"
            Size            =   9
            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 
               ColumnWidth     =   780.095
            EndProperty
            BeginProperty Column01 
               ColumnWidth     =   900.284
            EndProperty
         EndProperty
      End
      Begin VB.Label Label3 
         Caption         =   "姓名:"
         Height          =   255
         Left            =   2160
         TabIndex        =   17
         Top             =   480
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "学号:"
         Height          =   255
         Left            =   240
         TabIndex        =   16
         Top             =   480
         Width           =   855
      End
      Begin VB.Label Label5 
         Caption         =   "宿舍号:"
         Height          =   375
         Left            =   240
         TabIndex        =   15
         Top             =   1320
         Width           =   855
      End
      Begin VB.Label Label6 
         Caption         =   "性别:"
         Height          =   375
         Left            =   240
         TabIndex        =   14
         Top             =   840
         Width           =   615
      End
      Begin VB.Label 系别 
         Caption         =   "系别:"
         Height          =   375
         Left            =   2160
         TabIndex        =   13
         Top             =   960
         Width           =   615
      End
      Begin VB.Label Label7 
         Caption         =   "床位号:"
         Height          =   255
         Left            =   2160
         TabIndex        =   12
         Top             =   1440
         Width           =   855
      End
      Begin VB.Label Label8 
         Caption         =   "备注:"
         Height          =   255
         Left            =   4440
         TabIndex        =   11
         Top             =   1320
         Width           =   615
      End
   End
   Begin VB.CommandButton Command4 
      Caption         =   "退出"
      Height          =   495
      Left            =   5760
      TabIndex        =   0
      Top             =   6600
      Width           =   1695
   End
   Begin VB.Label Label9 
      Caption         =   "宿 舍 变 更"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   26.25
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   615
      Left            =   2400
      TabIndex        =   26
      Top             =   120
      Width           =   3255
   End
End
Attribute VB_Name = "frmchangeroom"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim con As ADODB.Connection
Private Sub Command1_Click()
 '查找记录
   Dim rs As New ADODB.Recordset
    Dim query1 As String
   
        query1 = "SELECT * FROM 学生信息 WHERE " & "学号" & " = '" & Trim(xh.Text) & "'"
   
    rs.Open query1, con, adOpenForwardOnly, adLockReadOnly
    Set DataGrid1.DataSource = Nothing
    If Not (rs.EOF And rs.BOF) Then
        rs.MoveFirst
        rs.MoveLast
    End If
    If rs.RecordCount > 0 Then
        Set DataGrid1.DataSource = rs
        MsgBox "总共查到" & rs.RecordCount & "记录", vbInformation
    Else
        MsgBox "没有找到记录,请重新输入查询数据", vbInformation
    End If
    
End Sub

Private Sub Command2_Click()
 '保存记录
    Dim myrs As New ADODB.Recordset
    myrs.Open "SELECT * FROM 学生信息", con, adOpenDynamic, adLockOptimistic, adCmdText
    myrs.AddNew

    If txtstuid.Text = Empty Then
        MsgBox "学号不能为空!"
        txtstuid.SetFocus
        Exit Sub
    End If
    If txtstuname.Text = Empty Then
        MsgBox "姓名不能为空!"
        txtstuname.SetFocus
        Exit Sub
    End If
    If Combosex.Text = Empty Then
       MsgBox "请选择性别!"
       Combosex.SetFocus
       Exit Sub
    End If
    
    If txtxb.Text = Empty Then
        MsgBox "请输入系别!"
        txtxb.SetFocus
        Exit Sub
    End If
    If txtssh.Text = Empty Then
        MsgBox "请输入宿舍号!"
        txtssh.SetFocus
        Exit Sub
    End If
    
    If txtcwh.Text = Empty Then
        MsgBox "请输入床位号!"
        txtcwh.SetFocus
        Exit Sub
    End If
    
    myrs.Fields(0) = txtstuid.Text
    myrs.Fields(1) = txtstuname.Text
    myrs.Fields(2) = Combosex.Text
    myrs.Fields(3) = txtxb.Text
    myrs.Fields(4) = txtssh.Text
    myrs.Fields(5) = txtcwh.Text
    myrs.Fields(6) = bz.Text
    myrs.Update     '调用Recordset对象Update方法保存数据
    Set DataGrid2.DataSource = myrs
    MsgBox "添加学生信息成功!"
End Sub

Private Sub Command3_Click()
Dim tx As New ADODB.Recordset
 Dim query As String
  If DataGrid1 <> "" Then
    If MsgBox("是否确认删除?", vbYesNo + vbCritical, "删除") = vbYes Then
        
       query = "SELECT * FROM 学生信息 "
       tx.Open query, con, 3, 3, 1
       tx.Delete
       tx.Update
       MsgBox "确定删除记录成功"
    End If
  Else
     MsgBox "请选择需要删除的记录!", vbOKOnly, "删除"
  End If '删除一条记录
End Sub

Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Form_Load()
 '创建连接,并打开
    Set con = New ADODB.Connection
    con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\数据.mdb;Persist Security Info=False"
    con.CursorLocation = adUseClient
    con.Open
End Sub

⌨️ 快捷键说明

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