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

📄 form5.frm

📁 用VB连接ORalce数据库的学生管理系统
💻 FRM
📖 第 1 页 / 共 2 页
字号:
         Left            =   600
         TabIndex        =   9
         Top             =   960
         Width           =   975
      End
      Begin VB.Label Label1 
         BackColor       =   &H00FFC0FF&
         Caption         =   "学号:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   600
         TabIndex        =   8
         Top             =   480
         Width           =   975
      End
      Begin VB.Label Label5 
         BackColor       =   &H00FFC0FF&
         Caption         =   "年龄"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   600
         TabIndex        =   7
         Top             =   1920
         Width           =   975
      End
      Begin VB.Label Label7 
         BackColor       =   &H00FFC0FF&
         Caption         =   "系别:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   600
         TabIndex        =   6
         Top             =   2400
         Width           =   975
      End
      Begin VB.Label Label8 
         BackColor       =   &H00FFC0FF&
         Caption         =   "班级:"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   10.5
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         ForeColor       =   &H00000000&
         Height          =   375
         Left            =   600
         TabIndex        =   5
         Top             =   3840
         Width           =   975
      End
   End
   Begin VB.Image Image1 
      Height          =   480
      Left            =   1800
      Picture         =   "Form5.frx":0000
      Top             =   240
      Width           =   480
   End
   Begin VB.Label Label10 
      BackColor       =   &H00FFC0FF&
      Caption         =   "修改学生档案"
      BeginProperty Font 
         Name            =   "楷体_GB2312"
         Size            =   26.25
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H00C00000&
      Height          =   615
      Left            =   3000
      TabIndex        =   16
      Top             =   240
      Width           =   3375
   End
End
Attribute VB_Name = "Form5"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public printstr As String
Private Sub Command1_Click()
    If Trim(Text1(4).Text) = "" Then
        MsgBox "学号不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(4).SetFocus
        Exit Sub
    End If
    If Trim(Text1(5).Text) = "" Then
        sql = "select * from student where sno='" & Trim(Text1(4).Text) & "'"
    End If
    If Trim(Text1(5).Text) <> "" Then
        sql = "select * from student where sno='" & Trim(Text1(4).Text) & "' and name='" & Trim(Text1(4).Text) & "'"
    End If
    Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Adodc1.Refresh
    If Adodc1.Recordset.EOF = True Then
        MsgBox " 不存在学号为" & Trim(Text1(4).Text) & "的学生!", vbExclamation + vbOKOnly, "警告"
        Text1(4).SetFocus
        Exit Sub
    End If
    If Trim(Text1(0).Text) = "" Then
        MsgBox "学号不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(0).SetFocus
        Exit Sub
    End If
    If Trim(Text1(1).Text) = "" Then
        MsgBox "姓名不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(1).SetFocus
        Exit Sub
    End If
    If Trim(Combo1.Text) = "" Then
        MsgBox "性别不能为空!", vbExclamation + vbOKOnly, "警告"
        Combo1.SetFocus
        Exit Sub
    End If
    Dim ssex As String
    If Trim(Combo1.Text) = "男" Then
    ssex = "man"
    End If
    If Trim(Combo1.Text) = "女" Then
    ssex = "woman"
    End If
    If Trim(Combo2.Text) = "" Then
        MsgBox "年龄不能为空!", vbExclamation + vbOKOnly, "警告"
        Combo2.SetFocus
        Exit Sub
    End If
    If Trim(Text2.Text) = "" Then
        MsgBox "系别不能为空!", vbExclamation + vbOKOnly, "警告"
        Text2.SetFocus
        Exit Sub
    End If
    If Trim(Text3.Text) = "" Then
        MsgBox "密码不能为空!", vbExclamation + vbOKOnly, "警告"
        Text3.SetFocus
        Exit Sub
    End If
    If Len(Text3.Text) > 20 Then
        MsgBox "密码长度不能超过20!", vbExclamation + vbOKOnly, "警告"
        Text3.SetFocus
        Exit Sub
    End If
    If Trim(Text3.Text) <> Trim(Text4.Text) Then
        MsgBox "两次密码不一致!", vbExclamation + vbOKOnly, "警告"
        Text4.SetFocus
        Exit Sub
    End If
    If Trim(Text5.Text) = "" Then
        MsgBox "班级不能为空!", vbExclamation + vbOKOnly, "警告"
        Text5.SetFocus
        Exit Sub
    End If
    If MsgBox("确定要修改学号为 " & Trim(Text1(4).Text) & " 的记录吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
        Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = "select * from student where sno='" & Trim(Text1(4).Text) & "'"
        Adodc1.Refresh
        If Adodc1.Recordset.EOF = True Then
           MsgBox "对不起,没此学生记录!", vbOKOnly, "查询"
           Text1(4).SetFocus
           Exit Sub
        End If
        Adodc1.Recordset.Delete
        Adodc1.Refresh
        Adodc1.Recordset.AddNew
        Adodc1.Recordset.Fields("sno").Value = Trim(Text1(0).Text)
        Adodc1.Recordset.Fields("name").Value = Trim(Text1(1).Text)
        Adodc1.Recordset.Fields("sex").Value = ssex
        Adodc1.Recordset.Fields("age").Value = Val(Combo2.Text)
        Adodc1.Recordset.Fields("dept").Value = Trim(Text2.Text)
        Adodc1.Recordset.Fields("key").Value = Trim(Text3.Text)
        Adodc1.Recordset.Fields("class").Value = Trim(Text5.Text)
        Adodc1.Recordset.Update
        Adodc1.Refresh
        MsgBox " 修改成功!", vbExclamation + vbOKOnly, "警告"
        Text1(0).Text = ""
        Text1(1).Text = ""
        Combo1.Text = ""
        Combo2.Text = ""
        Text2.Text = ""
        Text3.Text = ""
        Text4.Text = ""
        Text5.Text = ""
        Text1(4).Text = ""
        Text1(5).Text = ""
End If
        Text1(0).Text = ""
        Text1(1).Text = ""
        Combo1.Text = ""
        Combo2.Text = ""
        Text2.Text = ""
        Text3.Text = ""
        Text4.Text = ""
        Text5.Text = ""
        Text1(4).Text = ""
        Text1(5).Text = ""
        msql = sql
        Form3.printstr = sql
End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
    If Trim(Text1(4).Text) = "" Then
        MsgBox "学号不能为空!", vbExclamation + vbOKOnly, "警告"
        Text1(4).SetFocus
        Exit Sub
    End If
    If Trim(Text1(5).Text) = "" Then
        sql = "select * from student where sno='" & Trim(Text1(4).Text) & "'"
    End If
    If Trim(Text1(5).Text) <> "" Then
        sql = "select * from student where sno='" & Trim(Text1(4).Text) & "' and name='" & Trim(Text1(4).Text) & "'"
    End If
    Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
    Adodc1.CommandType = adCmdText
    Adodc1.RecordSource = sql
    Adodc1.Refresh
    If Adodc1.Recordset.EOF = True Then
        MsgBox " 不存在学号为" & Trim(Text1(4).Text) & "的学生!", vbExclamation + vbOKOnly, "警告"
        Text1(4).SetFocus
        Exit Sub
    End If
    If MsgBox("确定要删除学号为 " & Trim(Text1(4).Text) & " 的记录吗?" & Chr(13) & Chr(10) & "继续会导致该同学的记录和相关记录的数据丢失,继续吗?", vbOKCancel + vbExclamation, "警告") = vbOK Then
        Adodc1.ConnectionString = "Provider=MSDAORA.1;User ID=he;Persist Security Info=False"
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = "select * from student where sno='" & Trim(Text1(4).Text) & "'"
        Adodc1.Refresh
        If Adodc1.Recordset.EOF = True Then
           MsgBox "对不起,没此学生记录!", vbOKOnly, "查询"
           Text1(4).SetFocus
           Exit Sub
        End If
        Adodc1.Recordset.Delete
        Adodc1.Refresh
        sql = "select * from choose where sno ='" & Trim(Text1(4).Text) & "'"
        Adodc1.CommandType = adCmdText
        Adodc1.RecordSource = sql
        If Adodc1.Recordset.EOF = True Then
            MsgBox "选课表中没有该学生的信息!", vbOKOnly, "查询"
            GoTo b
        End If
        Adodc1.Recordset.Delete  '删除choose表中的数据
        Adodc1.Refresh
b:       MsgBox "删除成功!", vbOKOnly, "查询"
    Text1(4).Text = ""
    Text1(5).Text = ""
End If
    Text1(4).Text = ""
    Text1(5).Text = ""
End Sub

Private Sub Form_Load()
Combo1.AddItem "男"
Combo1.AddItem "女"
Combo2.AddItem "15"
Combo2.AddItem "16"
Combo2.AddItem "17"
Combo2.AddItem "18"
Combo2.AddItem "19"
Combo2.AddItem "20"
Combo2.AddItem "21"
Combo2.AddItem "22"
Combo2.AddItem "23"
Combo2.AddItem "24"
Combo2.AddItem "25"
Combo2.AddItem "26"
Combo2.AddItem "27"
Combo2.AddItem "28"
Combo2.AddItem "29"
Combo2.AddItem "30"
End Sub

⌨️ 快捷键说明

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