📄 modifydeleteinformation.frm
字号:
VERSION 5.00
Begin VB.Form ModifyDeleteInformation
BackColor = &H8000000A&
Caption = "修改删除学生信息"
ClientHeight = 3615
ClientLeft = 60
ClientTop = 345
ClientWidth = 5205
LinkTopic = "Form1"
ScaleHeight = 3615
ScaleWidth = 5205
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command3
Caption = "返回"
Height = 495
Left = 3480
TabIndex = 16
Top = 3000
Width = 735
End
Begin VB.CommandButton Command2
Caption = "删除确认"
Height = 495
Left = 2280
TabIndex = 15
Top = 3000
Width = 855
End
Begin VB.CommandButton Command1
Caption = "修改确认"
Height = 495
Left = 1080
TabIndex = 14
Top = 3000
Width = 855
End
Begin VB.Data Data1
Connect = "Access"
DatabaseName = "studentInformation.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 285
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "学生信息"
Top = 2520
Visible = 0 'False
Width = 3855
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "ModifyDeleteInformation.frx":0000
Left = 840
List = "ModifyDeleteInformation.frx":000A
TabIndex = 13
Top = 720
Width = 1335
End
Begin VB.TextBox Text6
Height = 375
Left = 840
TabIndex = 12
Top = 1920
Width = 2655
End
Begin VB.TextBox Text5
Height = 375
Left = 3120
TabIndex = 11
Top = 1320
Width = 1215
End
Begin VB.TextBox Text4
Height = 375
Left = 840
TabIndex = 10
Top = 1320
Width = 1335
End
Begin VB.TextBox Text3
Height = 375
Left = 3120
TabIndex = 9
Top = 720
Width = 1215
End
Begin VB.TextBox Text2
Height = 375
Left = 3120
TabIndex = 8
Top = 120
Width = 1215
End
Begin VB.TextBox Text1
Height = 375
Left = 840
TabIndex = 7
Top = 120
Width = 1335
End
Begin VB.Label Label7
BackStyle = 0 'Transparent
Caption = "寝室电话"
Height = 495
Left = 2280
TabIndex = 6
Top = 1320
Width = 735
End
Begin VB.Label Label6
BackStyle = 0 'Transparent
Caption = "寝室号"
Height = 495
Left = 240
TabIndex = 5
Top = 1320
Width = 735
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "出生年月"
Height = 495
Left = 2280
TabIndex = 4
Top = 720
Width = 735
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "性别"
Height = 495
Left = 240
TabIndex = 3
Top = 720
Width = 735
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "姓名"
Height = 495
Left = 2400
TabIndex = 2
Top = 240
Width = 735
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "学号"
Height = 495
Left = 240
TabIndex = 1
Top = 240
Width = 735
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "专业"
Height = 495
Left = 240
TabIndex = 0
Top = 1920
Width = 615
End
End
Attribute VB_Name = "ModifyDeleteInformation"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Command2.Enabled = False
Data1.RecordSource = "用户信息"
Data1.Recordset.Edit
Data1.Recordset.Fields("学号") = Text1.Text
Data1.Recordset.Fields("姓名") = Text2.Text
Data1.Recordset.Fields("出生年月") = Text3.Text
Data1.Recordset.Fields("寝室号") = Text4.Text
Data1.Recordset.Fields("寝室电话") = Text5.Text
Data1.Recordset.Fields("专业") = Text6.Text
Data1.Recordset.Fields("性别") = Combo1.Text
Data1.Recordset.Update
Data1.Refresh
Text1.Text = "": Text2.Text = "": Text3.Text = ""
Text4.Text = "": Text5.Text = "": Text6.Text = ""
Combo1.Text = ""
Me.Hide
End Sub
Private Sub Command2_Click()
Command1.Enabled = False
Data1.RecordSource = "学生信息"
Data1.Recordset.Delete
Data1.Recordset.MoveNext
If Data1.Recordset.EOF Then Data1.Recordset.MoveLast
Data1.Refresh
Text1.Text = "": Text2.Text = "": Text3.Text = ""
Text4.Text = "": Text5.Text = "": Text6.Text = ""
Combo1.Text = ""
Me.Hide
End Sub
Private Sub Command3_Click()
Text1.Text = "": Text2.Text = "": Text3.Text = ""
Text4.Text = "": Text5.Text = "": Text6.Text = ""
Combo1.Text = ""
Me.Hide
End Sub
Private Sub Form_Load()
Dim str1 As String, str As String * 11
str1 = "你想修改或删除哪位同学的信息?" + Chr(13) + Chr(10) + "请输入此学生的学号!"
str = InputBox(str1, "询问提示", , 100, 100)
Data1.RecordSource = "Select *From 学生信息 Where 学号 ='" & str & "'"
Data1.Refresh
If Data1.Recordset.EOF Then
MsgBox "对不起没有这个用户!", vbOKCancel + vbExclamation, "错误提示"
Data1.RecordSource = "学生信息"
Data1.Refresh
Else
Data1.RecordSource = "学生信息"
Text1.Text = Data1.Recordset.Fields("学号")
Text2.Text = Data1.Recordset.Fields("姓名")
Combo1.Text = Data1.Recordset.Fields("性别")
Text3.Text = Data1.Recordset.Fields("出生年月")
Text4.Text = Data1.Recordset.Fields("寝室号")
Text5.Text = Data1.Recordset.Fields("寝室电话")
Text6.Text = Data1.Recordset.Fields("专业")
Data1.Refresh
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -