📄 form6.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "msadodc.ocx"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form Form6
Caption = "Form6"
ClientHeight = 5235
ClientLeft = 60
ClientTop = 345
ClientWidth = 8085
LinkTopic = "Form6"
ScaleHeight = 5235
ScaleWidth = 8085
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command5
Caption = "关闭"
Height = 375
Left = 5400
TabIndex = 19
Top = 4680
Width = 1455
End
Begin MSDataGridLib.DataGrid DataGrid1
Height = 3015
Left = 3480
TabIndex = 13
Top = 360
Width = 4215
_ExtentX = 7435
_ExtentY = 5318
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.TextBox Text1
DataField = "学号"
DataSource = "Adodc1"
Height = 270
Left = 1080
TabIndex = 12
Text = "Text1"
Top = 360
Width = 1215
End
Begin VB.TextBox Text2
DataField = "姓名"
DataSource = "Adodc1"
Height = 270
Left = 1080
TabIndex = 3
Text = "Text2"
Top = 840
Width = 1215
End
Begin VB.Frame Frame1
Caption = "学生基本信息"
Height = 4335
Left = 120
TabIndex = 0
Top = 120
Width = 3135
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 240
Top = 3360
Width = 2415
_ExtentX = 4260
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox Text6
DataField = "联系电话"
DataSource = "Adodc1"
Height = 270
Left = 960
TabIndex = 11
Text = "Text6"
Top = 2520
Width = 1215
End
Begin VB.TextBox Text5
DataField = "出生日期"
DataSource = "Adodc1"
Height = 270
Left = 960
TabIndex = 9
Text = "Text5"
Top = 2040
Width = 1215
End
Begin VB.TextBox Text4
DataField = "班级"
DataSource = "Adodc1"
Height = 270
Left = 960
TabIndex = 7
Text = "Text4"
Top = 1560
Width = 1215
End
Begin VB.TextBox Text3
DataField = "性别"
DataSource = "Adodc1"
Height = 270
Left = 960
TabIndex = 5
Text = "Text3"
Top = 1080
Width = 1215
End
Begin VB.Label Label6
Caption = "电话"
Height = 255
Left = 120
TabIndex = 10
Top = 2520
Width = 615
End
Begin VB.Label Label5
Caption = "出身日期"
Height = 375
Left = 120
TabIndex = 8
Top = 2040
Width = 735
End
Begin VB.Label Label4
Caption = "班级"
Height = 255
Left = 120
TabIndex = 6
Top = 1560
Width = 375
End
Begin VB.Label Label3
Caption = "性别"
Height = 255
Left = 120
TabIndex = 4
Top = 1080
Width = 375
End
Begin VB.Label Label2
Caption = "姓名"
Height = 375
Left = 120
TabIndex = 2
Top = 600
Width = 375
End
Begin VB.Label Label1
Caption = "学号"
Height = 255
Left = 120
TabIndex = 1
Top = 240
Width = 495
End
End
Begin VB.Frame Frame2
Caption = "Frame2"
Height = 4335
Left = 3360
TabIndex = 14
Top = 120
Width = 4575
Begin VB.CommandButton Command4
Caption = "更新"
Height = 375
Left = 120
TabIndex = 18
Top = 3360
Width = 855
End
Begin VB.CommandButton Command3
Caption = "增加"
Height = 375
Left = 1080
TabIndex = 17
Top = 3360
Width = 975
End
Begin VB.CommandButton Command2
Caption = "删除"
Height = 375
Left = 3240
TabIndex = 16
Top = 3360
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "保存"
Height = 375
Left = 2160
TabIndex = 15
Top = 3360
Width = 975
End
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 3960
Top = 3000
Width = 2295
_ExtentX = 4048
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private conn As ADODB.Connection
Private rs As ADODB.Recordset
Private Sub Command1_Click()
Adodc2.Recordset.Update
MsgBox "更新成功!", , "系统提示"
'Command3.Enabled = False
Adodc1.Tag = 0
End Sub
Private Sub Command2_Click()
If MsgBox("真的要删除吗?", vbYesNo, "") = vbYes Then
Adodc2.Recordset.Delete
Adodc2.Recordset.MoveNext
If Adodc2.Recordset.EOF Then
Adodc2.Recordset.MoveFirst
End If
End If
Adodc2.Tag = 0
End Sub
Private Sub Command3_Click()
Form5.Show 1
End Sub
Private Sub Command4_Click()
Text1_Change
End Sub
Private Sub Command5_Click()
Me.Hide
End Sub
Private Sub Form_Load()
Dim sql As String
'基本信息
Set rs = New Recordset
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\student.mdb;Persist Security Info=False"
Adodc1.CommandType = adCmdText
sql = "select * from 学生基本信息 order by id desc"
Adodc1.RecordSource = sql
Adodc1.Refresh
'学生成绩
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\student.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
sql = "select 成绩,科目ID,班级ID from 学生成绩 where 学生ID = " & Text1.Text
Adodc2.RecordSource = sql
Adodc2.Refresh
Set DataGrid1.DataSource = Adodc2
DataGrid1.Refresh
Adodc2.Tag = 0
End Sub
Private Sub Text1_Change()
'学生成绩
If Text1.Text <> "" Then
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + App.Path + "\student.mdb;Persist Security Info=False"
Adodc2.CommandType = adCmdText
sql = "select 成绩,科目ID,班级ID from 学生成绩 where 学生ID = " & Text1.Text
Adodc2.RecordSource = sql
Adodc2.Refresh
Set DataGrid1.DataSource = Adodc2
DataGrid1.Refresh
Adodc2.Tag = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -