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

📄 frmforc.frm

📁 数据库学生信息管理系统(02060204)
💻 FRM
字号:
VERSION 5.00
Begin VB.Form frmForS 
   Caption         =   "frmForS"
   ClientHeight    =   4380
   ClientLeft      =   4470
   ClientTop       =   1950
   ClientWidth     =   6390
   LinkTopic       =   "Form1"
   ScaleHeight     =   4380
   ScaleWidth      =   6390
   Begin VB.CommandButton WantUpdate 
      Caption         =   "我要修改"
      Height          =   495
      Left            =   2520
      TabIndex        =   17
      Top             =   3840
      Width           =   1215
   End
   Begin VB.CommandButton cmdWantAdd 
      Caption         =   "我要填加"
      Height          =   495
      Left            =   1320
      TabIndex        =   16
      Top             =   3840
      Width           =   1215
   End
   Begin VB.CommandButton cmdContinu 
      Caption         =   "继续查找"
      Height          =   495
      Left            =   120
      TabIndex        =   15
      Top             =   3840
      Width           =   1215
   End
   Begin VB.TextBox txtSsex 
      Height          =   495
      Left            =   5280
      TabIndex        =   14
      Top             =   1080
      Width           =   495
   End
   Begin VB.TextBox txtSdept 
      Height          =   495
      Left            =   3240
      TabIndex        =   12
      Top             =   2760
      Width           =   1215
   End
   Begin VB.CommandButton cmdExit 
      Caption         =   "退出"
      Height          =   495
      Left            =   4920
      TabIndex        =   10
      Top             =   3360
      Width           =   1215
   End
   Begin VB.CommandButton cmdDelete 
      Caption         =   "删除"
      Height          =   495
      Left            =   3720
      TabIndex        =   9
      Top             =   3360
      Width           =   1215
   End
   Begin VB.CommandButton cmdUpdate 
      Caption         =   "修改"
      Height          =   495
      Left            =   2520
      TabIndex        =   8
      Top             =   3360
      Width           =   1215
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "填加"
      Height          =   495
      Left            =   1320
      TabIndex        =   7
      Top             =   3360
      Width           =   1215
   End
   Begin VB.CommandButton cmdSearch 
      Caption         =   "查找"
      Height          =   495
      Left            =   120
      TabIndex        =   6
      Top             =   3360
      Width           =   1215
   End
   Begin VB.TextBox txtSage 
      Height          =   495
      Left            =   3240
      TabIndex        =   5
      Top             =   1920
      Width           =   1215
   End
   Begin VB.TextBox txtSname 
      Height          =   495
      Left            =   3240
      TabIndex        =   4
      Top             =   1080
      Width           =   1215
   End
   Begin VB.TextBox txtSno 
      Height          =   495
      Left            =   3240
      TabIndex        =   3
      Top             =   240
      Width           =   1215
   End
   Begin VB.Label Label5 
      Caption         =   "性别:"
      Height          =   495
      Left            =   4560
      TabIndex        =   13
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label Label4 
      Caption         =   "系别"
      Height          =   495
      Left            =   1560
      TabIndex        =   11
      Top             =   2760
      Width           =   1215
   End
   Begin VB.Label Label3 
      Caption         =   "年龄:"
      Height          =   495
      Left            =   1560
      TabIndex        =   2
      Top             =   1920
      Width           =   1215
   End
   Begin VB.Label Label2 
      Caption         =   "姓名:"
      Height          =   495
      Left            =   1560
      TabIndex        =   1
      Top             =   1080
      Width           =   1215
   End
   Begin VB.Label Label1 
      Caption         =   "学号:"
      Height          =   495
      Left            =   1560
      TabIndex        =   0
      Top             =   240
      Width           =   1215
   End
End
Attribute VB_Name = "frmForS"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdAdd_Click()
Dim sql As String
sql = "insert into student(sno,sname,ssex,sage,sdept)  values('" & txtSno.Text & "','" & txtSname.Text & "','" & txtSsex.Text & "','" & txtSage.Text & "','" & txtSdept.Text & "');"
cn.Execute sql
txtSno.Text = ""
txtSname.Text = ""
txtSsex.Text = ""
txtSage.Text = ""
txtSdept.Text = ""
End Sub

Private Sub cmdContinu_Click()
txtSno.Enabled = True
txtSno.Text = ""
txtSname.Text = ""
txtSsex.Text = ""
txtSage.Text = ""
txtSdept.Text = ""

End Sub

Private Sub cmdDelete_Click()
Dim sql As String
sql = "delete from student where sno='" & txtSno.Text & "';"
cn.Execute sql

End Sub

Private Sub cmdExit_Click()
Unload Me
End Sub

Private Sub cmdSearch_Click()
Dim rst As New ADODB.Recordset
Dim sql As String

If txtSname.Text = "" And txtSno <> "" Then
sql = "select * from student where sno='" & txtSno & "';"
rst.Open sql, cn, adOpenStatic
txtSno.Text = rst!Sno
txtSname.Text = rst!sname
txtSsex.Text = rst!ssex
txtSage.Text = rst!sage
txtSdept.Text = rst!sdept
End If

If txtSname.Text <> "" And txtSno = "" Then
sql = "select * from student where sname='" & txtSname & "';"
rst.Open sql, cn, adOpenStatic
txtSno.Text = rst!Sno
txtSname.Text = rst!sname
txtSsex.Text = rst!ssex
txtSage.Text = rst!sage
txtSdept.Text = rst!sdept
End If

If txtSname.Text = "" And txtSno.Text = "" Then
MsgBox "输入啊!"
End If

End Sub

Private Sub cmdUpdate_Click()
Dim sql As String
sql = "update student set sname='" & txtSname.Text & "',ssex='" & txtSsex.Text & "',sage='" & txtSage.Text & "',sdept='" & txtSdept.Text & "' where sno='" & txtSno.Text & "';"
cn.Execute sql
MsgBox "修改成功!"
txtSno.Text = ""
txtSname.Text = ""
txtSsex.Text = ""
txtSage.Text = ""
txtSdept.Text = ""
End Sub

Private Sub cmdWantAdd_Click()
txtSno.Text = ""
txtSname.Text = ""
txtSsex.Text = ""
txtSage.Text = ""
txtSdept.Text = ""
End Sub

Private Sub WantUpdate_Click()
txtSno.Enabled = False
End Sub

⌨️ 快捷键说明

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