📄 form7.frm
字号:
VERSION 5.00
Begin VB.Form Form7
Caption = "Form7"
ClientHeight = 5775
ClientLeft = 60
ClientTop = 510
ClientWidth = 5925
LinkTopic = "Form7"
ScaleHeight = 5775
ScaleWidth = 5925
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command2
Caption = "退出"
Height = 615
Left = 4680
TabIndex = 14
Top = 4680
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 615
Left = 4680
TabIndex = 13
Top = 3600
Width = 1095
End
Begin VB.Frame Frame1
Caption = "添加成绩框"
Height = 5175
Left = 120
TabIndex = 0
Top = 360
Width = 4335
Begin VB.TextBox Text6
Height = 495
Left = 1800
TabIndex = 12
Top = 4320
Width = 1095
End
Begin VB.TextBox Text5
Height = 495
Left = 1800
TabIndex = 11
Top = 3600
Width = 1095
End
Begin VB.TextBox Text4
Height = 495
Left = 1800
TabIndex = 10
Top = 2880
Width = 1095
End
Begin VB.TextBox Text3
Height = 495
Left = 1800
TabIndex = 9
Top = 2160
Width = 1095
End
Begin VB.TextBox Text2
Height = 495
Left = 1800
TabIndex = 8
Top = 1320
Width = 1695
End
Begin VB.TextBox Text1
Height = 495
Left = 1800
TabIndex = 2
Top = 600
Width = 1695
End
Begin VB.Label Label6
Caption = "专业课"
Height = 495
Left = 120
TabIndex = 7
Top = 4440
Width = 1215
End
Begin VB.Label Label5
Caption = "政治理论"
Height = 375
Left = 120
TabIndex = 6
Top = 3720
Width = 1215
End
Begin VB.Label Label4
Caption = "数学"
Height = 495
Left = 120
TabIndex = 5
Top = 3000
Width = 1215
End
Begin VB.Label Label3
Caption = "英语成绩"
Height = 495
Left = 120
TabIndex = 4
Top = 2160
Width = 1215
End
Begin VB.Label Label2
Caption = "学生学号"
Height = 495
Left = 120
TabIndex = 3
Top = 1320
Width = 1215
End
Begin VB.Label Label1
Caption = "学生姓名"
Height = 495
Left = 120
TabIndex = 1
Top = 600
Width = 1095
End
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim i As Integer
Set cn = New ADODB.Connection
cn.ConnectionString = "driver={sql server};server=fu;uid=sa;pwd=;database=sinformation"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "select * from grade", cn, adOpenDynamic, adLockOptimistic
If IsNumeric(Text3.Text) Then
rs.AddNew
rs.Fields(0) = Text1.Text
rs.Fields(1) = Text2.Text
rs.Fields(2) = Text6.Text
rs.Fields(3) = Text3.Text
rs.Fields(4) = Text4.Text
rs.Fields(5) = Text5.Text
rs.Update
rs.Close
MsgBox "学生信息添加成功", , "提示"
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Text6.Text = ""
Else
MsgBox "请在年龄框内输入数字", , "警告"
SendKeys "{home}+{end}"
End If
End Sub
Private Sub Command2_Click()
Form7.Hide
Form1.Show
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -