📄 login8.frm
字号:
VERSION 5.00
Begin VB.Form login8
Caption = "添加成绩"
ClientHeight = 5190
ClientLeft = 60
ClientTop = 345
ClientWidth = 6315
LinkTopic = "Form1"
ScaleHeight = 5190
ScaleWidth = 6315
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame1
Caption = "添加"
Height = 5175
Left = 240
TabIndex = 0
Top = 0
Width = 5775
Begin VB.CommandButton Command2
Caption = "取消添加"
Height = 615
Left = 2880
TabIndex = 12
Top = 3960
Width = 1455
End
Begin VB.CommandButton Command1
Caption = "确定添加"
Height = 615
Left = 360
TabIndex = 11
Top = 3960
Width = 1335
End
Begin VB.TextBox Text5
Height = 495
Left = 840
TabIndex = 9
Top = 3000
Width = 2415
End
Begin VB.TextBox Text4
Height = 495
Left = 840
TabIndex = 8
Top = 2280
Width = 2415
End
Begin VB.TextBox Text3
Height = 495
Left = 840
TabIndex = 6
Top = 1680
Width = 2415
End
Begin VB.TextBox Text2
Height = 495
Left = 840
TabIndex = 3
Top = 1080
Width = 2415
End
Begin VB.TextBox Text1
Height = 495
Left = 840
TabIndex = 1
Top = 480
Width = 2415
End
Begin VB.Label Label5
Caption = "网页"
Height = 375
Left = 240
TabIndex = 10
Top = 3120
Width = 495
End
Begin VB.Label Label4
Caption = "c语言"
Height = 255
Left = 120
TabIndex = 7
Top = 2400
Width = 735
End
Begin VB.Label Label3
Caption = "微机原理"
Height = 255
Left = 120
TabIndex = 5
Top = 1800
Width = 735
End
Begin VB.Label Label2
Caption = "学号"
Height = 255
Left = 240
TabIndex = 4
Top = 1200
Width = 615
End
Begin VB.Label Label1
Caption = "班级"
Height = 255
Left = 240
TabIndex = 2
Top = 600
Width = 615
End
End
End
Attribute VB_Name = "login8"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public rs1 As ADODB.Recordset
Public con As ADODB.Connection
Public rs As ADODB.Recordset
Public conn As ADODB.Connection
Private Sub Command1_Click()
Dim sql As String
Dim rr As String
Dim str As String
On Error GoTo Command1_Click_Error
Set rs = New ADODB.Recordset
Set conn = New ADODB.Connection
Set rs1 = New ADODB.Recordset
Set con = New ADODB.Connection
str = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\Person.mdb"
con.Open str
conn.Open str
rr = "select * from students where 学号='" & Text2.Text & "'"
rs1.Open rr, con, adOpenKeyset, adLockOptimistic, adCmdText
If Trim(Text1.Text = "") Or Trim(Text2.Text = "") Or Trim(Text3.Text = "") Or Trim(Text4.Text = "") Or Trim(Text5.Text = "") Then
MsgBox " 请输入完整信息", vbOKOnly + vbExclamation, "提示!"
Else
If rs1.EOF = False Then
sql = "select * from chengji"
rs.Open sql, conn, adOpenKeyset, adLockOptimistic, adCmdText
If rs.EOF = True Then
rs.addnew
rs(0) = Text1.Text
rs(1) = Text2.Text
rs(2) = Text3.Text
rs(3) = Text4.Text
rs(4) = Text5.Text
rs.update
MsgBox "记录添加成功", vbOKOnly + vbExclamation, "提示!"
Else
MsgBox "有这个学生", vbOKOnly + vbExclamation, "提示!"
End If
Else
MsgBox "没有这个学生", vbOKOnly + vbExclamation, "提示!"
End If
End If
Command1_Click_Error:
Exit Sub
End Sub
Private Sub Command2_Click()
Unload Me
Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -