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

📄 xinxueqi.frm

📁 带有SQL
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Left            =   3480
            TabIndex        =   19
            Top             =   4440
            Width           =   210
         End
         Begin VB.Label Label6 
            AutoSize        =   -1  'True
            Caption         =   "寝室费用:"
            Height          =   180
            Left            =   360
            TabIndex        =   18
            Top             =   4320
            Width           =   900
         End
         Begin VB.Label Label5 
            AutoSize        =   -1  'True
            Caption         =   "寝 室 号:"
            Height          =   180
            Left            =   360
            TabIndex        =   17
            Top             =   3120
            Width           =   900
         End
         Begin VB.Label Label4 
            AutoSize        =   -1  'True
            Caption         =   "居住楼号:"
            Height          =   180
            Left            =   4200
            TabIndex        =   16
            Top             =   2040
            Width           =   900
         End
         Begin VB.Label Label3 
            AutoSize        =   -1  'True
            Caption         =   "姓   名:"
            Height          =   180
            Left            =   4320
            TabIndex        =   15
            Top             =   840
            Width           =   810
         End
         Begin VB.Label Label2 
            AutoSize        =   -1  'True
            Caption         =   "学   号:"
            Height          =   180
            Left            =   480
            TabIndex        =   14
            Top             =   840
            Width           =   810
         End
         Begin VB.Label Label13 
            AutoSize        =   -1  'True
            Caption         =   "季   度:"
            Height          =   180
            Left            =   4200
            TabIndex        =   13
            Top             =   3120
            Width           =   810
         End
      End
   End
   Begin VB.Label Label1 
      AutoSize        =   -1  'True
      Caption         =   "新学期注册"
      BeginProperty Font 
         Name            =   "幼圆"
         Size            =   21.75
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   435
      Left            =   5160
      TabIndex        =   1
      Top             =   120
      Width           =   2250
   End
End
Attribute VB_Name = "xinxueqi"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Combo4_Click()
      Me.MonthView1.Visible = True
      
End Sub

Private Sub Command1_Click()
    Dim mrc As ADODB.Recordset
    Dim txtSQL As String
    Dim MsgText As String
     '判断各个输入框中是否为空
    If Me.Text1.Text = "" Then
        MsgBox "请输入学号!", vbOKOnly + vbExclamation, "警告"
        Me.Text1.SetFocus
        Me.Text1.Text = ""
        Exit Sub
    End If
    If Not IsNumeric(Trim(Me.Text1.Text)) Then
               MsgBox "学号必须为数字型!,请重新输入!", vbOKOnly + vbExclamation, "警告"
               Me.Text1.Text = ""
               Me.Text1.SetFocus
               Exit Sub
        End If
      
    If Me.Text2.Text = "" Then
        MsgBox "请输入姓名!", vbOKOnly + vbExclamation, "警告"
        Me.Text2.SetFocus
        Exit Sub
    End If
    If Me.Combo1.Text = "" Then
        MsgBox "您没有选择性别!", vbOKOnly + vbExclamation, "警告"
        Me.Combo1.SetFocus
        Exit Sub
    End If
    If Trim(Me.Text3.Text = "") Then
       MsgBox "居住号不可为空!", vbOKOnly + vbExclamation, "警告"
        Me.Text3.SetFocus
        Exit Sub
    End If
    If Trim(Me.Text4.Text = "") Then
       MsgBox "寝室号不可为空!", vbOKOnly + vbExclamation, "警告"
        Me.Text4.SetFocus
        Exit Sub
    End If
    If Me.Combo2.Text = "" Then
        MsgBox "请选择费用类型!", vbOKOnly + vbExclamation, "警告"
        Me.Combo2.SetFocus
        Exit Sub
    End If
    If Me.Combo2.Text = "" Then
        MsgBox "请选择交费情况!", vbOKOnly + vbExclamation, "警告"
        Me.Combo3.SetFocus
        Exit Sub
    End If
    If Me.Text5.Text = "" Then
        MsgBox "请输入注册的季度!", vbOKOnly + vbExclamation, "警告"
        Me.Text5.SetFocus
        Exit Sub
    End If
    If Me.Text6.Text = "" Then
        MsgBox "请选择注册日期!", vbOKOnly + vbExclamation, "警告"
        Me.Text6.SetFocus
        Exit Sub
    End If
    '首先查询学生表中是否有学号的学生
     txtSQL = "select  student_ID from student_if where student_ID  = '" & Trim(Me.Text1.Text) & "'"
     Set mrc = ExecuteSQL(txtSQL, MsgText)
     If mrc.EOF = False Then
        
    '如果学生表中没有这个学生,则还要再次查询新学生注册表中是否有相同的学生号
    '开始查询数据库里的学生的学号是否重复
        txtSQL = "select  student_ID from xin_zc where student_ID  = '" & Trim(Me.Text1.Text) & "'"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        If mrc.EOF = False Then
           MsgBox "这个学号已经有了,请重新输入!", vbOKOnly + vbExclamation, "警告"
           mrc.Close
           Me.Text1.Text = ""
           Me.Text1.SetFocus
        Else
          mrc.Close
        
        txtSQL = "select * from xin_zc"
        Set mrc = ExecuteSQL(txtSQL, MsgText)
        mrc.AddNew    '添加一条记录
                mrc.Fields(0) = Trim(Me.Text1.Text)
                mrc.Fields(1) = Trim(Me.Text2.Text)
                mrc.Fields(2) = Trim(Me.Combo1.Text)
                mrc.Fields(3) = Trim(Me.Text3.Text)
                mrc.Fields(4) = Trim(Me.Text4.Text)
                mrc.Fields(5) = Trim(Me.Text5.Text)
                mrc.Fields(6) = Trim(Me.Combo2.Text)
                mrc.Fields(7) = Trim(Me.Combo3.Text)
                mrc.Fields(8) = Trim(Me.Text6.Text)
                mrc.Fields(9) = Trim(Me.Text7.Text)
                mrc.Update
                mrc.Close
                MsgBox "新注册的信息成功!", vbOKOnly + vbExclamation, "提示"
                Me.Text1.Text = ""
                Me.Text2.Text = ""
                Me.Combo1.Text = ""
                Me.Text3.Text = ""
                Me.Text4.Text = ""
                Me.Text5.Text = ""
                Me.Combo2.Text = ""
                Me.Combo3.Text = ""
                Me.Text6.Text = ""
                Me.Text7.Text = ""
                
     End If
    Else
       MsgBox "不存在这个学号,请重新输入!", vbOKOnly + vbExclamation, "警告"
       mrc.Close
       Exit Sub
    
    End If
    
End Sub

Private Sub loading()
    Me.Top = 0
    Me.Width = 13900
    Me.Height = 9500
    Me.Left = 0
    Me.Combo2.Text = "900"
    Me.Combo3.AddItem "已交"
    Me.Combo3.AddItem "未交"
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub

Private Sub Form_Load()
    Call loading
End Sub

Private Sub MonthView1_DateDblClick(ByVal DateDblClicked As Date)
        Me.Text6.Text = Me.MonthView1.Year & "-" & Me.MonthView1.Month & "-" & Me.MonthView1.Day
End Sub

⌨️ 快捷键说明

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