📄 form2.frm
字号:
VERSION 5.00
Begin VB.Form Form2
Caption = "Form2"
ClientHeight = 5100
ClientLeft = 1980
ClientTop = 1590
ClientWidth = 6915
LinkTopic = "Form2"
ScaleHeight = 5100
ScaleWidth = 6915
Begin VB.CommandButton Command2
Caption = "关闭"
Height = 375
Left = 2640
TabIndex = 27
Top = 4200
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "增加记录"
Height = 375
Left = 1080
TabIndex = 17
Top = 4200
Width = 1215
End
Begin VB.TextBox Text11
Height = 270
Left = 1080
TabIndex = 16
Top = 3720
Width = 4335
End
Begin VB.TextBox Text10
Height = 270
Left = 3960
TabIndex = 15
Top = 2400
Width = 1215
End
Begin VB.TextBox Text9
Height = 270
Left = 3960
TabIndex = 14
Top = 1920
Width = 1215
End
Begin VB.TextBox Text8
BeginProperty DataFormat
Type = 1
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 270
Left = 3960
TabIndex = 13
Top = 1440
Width = 1215
End
Begin VB.TextBox Text7
BeginProperty DataFormat
Type = 1
Format = "yyyy-MM-dd"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 3
EndProperty
Height = 270
Left = 3960
TabIndex = 12
Top = 960
Width = 1215
End
Begin VB.TextBox Text6
Height = 270
Left = 3960
TabIndex = 11
Top = 480
Width = 1215
End
Begin VB.TextBox Text5
Height = 270
Left = 3960
TabIndex = 10
Top = 3120
Width = 1215
End
Begin VB.TextBox Text4
Height = 270
Left = 1080
TabIndex = 9
Top = 3120
Width = 1215
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form2.frx":0000
Left = 1080
List = "Form2.frx":000A
TabIndex = 7
Top = 2520
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Left = 1080
TabIndex = 6
Top = 1920
Width = 1215
End
Begin VB.TextBox Text3
Height = 270
Left = 1080
TabIndex = 5
Top = 1440
Width = 1215
End
Begin VB.TextBox Text2
Height = 270
Left = 1080
TabIndex = 2
Top = 960
Width = 1215
End
Begin VB.TextBox Text1
BeginProperty DataFormat
Type = 1
Format = "0"
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 1
EndProperty
Height = 270
Left = 1080
TabIndex = 0
Top = 480
Width = 1215
End
Begin VB.Label Label13
Caption = "家庭地址"
Height = 255
Left = 240
TabIndex = 26
Top = 3720
Width = 975
End
Begin VB.Label Label12
Caption = "邮政编码"
Height = 255
Left = 2640
TabIndex = 25
Top = 2400
Width = 855
End
Begin VB.Label Label11
Caption = "联系电话"
Height = 375
Left = 2640
TabIndex = 24
Top = 1920
Width = 855
End
Begin VB.Label Label10
Caption = "出生日期"
Height = 255
Left = 2640
TabIndex = 23
Top = 1440
Width = 855
End
Begin VB.Label Label9
Caption = "入学时间"
Height = 375
Left = 2640
TabIndex = 22
Top = 960
Width = 735
End
Begin VB.Label Label8
Caption = "家长姓名"
Height = 495
Left = 2640
TabIndex = 21
Top = 480
Width = 1215
End
Begin VB.Label Label7
Caption = "政治面貌"
Height = 255
Left = 2640
TabIndex = 20
Top = 3120
Width = 855
End
Begin VB.Label Label6
Caption = "籍贯"
Height = 375
Left = 240
TabIndex = 19
Top = 3120
Width = 495
End
Begin VB.Label Label5
Caption = "班级"
Height = 375
Left = 240
TabIndex = 18
Top = 1920
Width = 495
End
Begin VB.Label Label4
Caption = "性别"
Height = 255
Left = 240
TabIndex = 8
Top = 2520
Width = 375
End
Begin VB.Label Label3
Caption = "民族"
Height = 255
Left = 240
TabIndex = 4
Top = 1440
Width = 375
End
Begin VB.Label Label2
Caption = "姓名"
Height = 255
Left = 240
TabIndex = 3
Top = 960
Width = 375
End
Begin VB.Label Label1
Caption = "学号"
Height = 255
Left = 240
TabIndex = 1
Top = 480
Width = 495
End
End
Attribute VB_Name = "Form2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public conn As New ADODB.Connection
Public rs As New ADODB.Recordset
Private Sub Command1_Click()
Dim sql As String
If Text1.Text = "" Then
MsgBox "学号不能为空", vbInformation, "提示"
Text1.SetFocus
Else
sql = "insert into 学生基本信息(学号,姓名,民族,班级,性别,籍贯,政治面貌,家长姓名,入学时间,出生日期,联系电话,在校状态,邮政编码,家庭地址) values(" & Text1.Text & ",'" & Text2.Text & "','" & Text3.Text & "','" & Combo1.Text & "','" & Combo2.Text & "','" & Text4.Text & "','" & Text5.Text & "','" & Text6.Text & "','" & Text7.Text & "','" & Text8.Text & "','" & Text9.Text & "','在校','" & Text10.Text & "','" & Text11.Text & "')"
MsgBox "增加成功"
'rs.Open sql, conn
conn.Execute sql
End If
End Sub
Private Sub Command2_Click()
Me.Hide
End Sub
Private Sub Form_Load()
conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\student.mdb;Persist Security Info=False"
conn.Open
rs.Open "select * from 班级", conn
Do While Not rs.EOF
'Debug.Print rs.Fields(0)
Combo1.AddItem (rs("班级"))
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
'conn.Close
' Set conn = Nothing
End Sub
Private Sub Frame1_DragDrop(Source As Control, X As Single, Y As Single)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -