📄 form7.frm
字号:
End
Begin VB.CommandButton cmdsave
Caption = "保存"
Height = 360
Left = 7215
TabIndex = 35
Top = 750
Width = 1005
End
Begin MSDataListLib.DataCombo DataCombo2
Height = 330
Left = 1035
TabIndex = 33
Top = 780
Width = 1440
_ExtentX = 2540
_ExtentY = 582
_Version = 393216
Text = "DataCombo2"
End
Begin MSDataListLib.DataCombo DataCombo1
Height = 330
Left = 5940
TabIndex = 32
Top = 255
Width = 1575
_ExtentX = 2778
_ExtentY = 582
_Version = 393216
Text = "DataCombo1"
End
Begin VB.CommandButton cmdadd
Caption = "添加成绩"
Height = 375
Left = 5895
TabIndex = 11
Top = 750
Width = 1050
End
Begin VB.TextBox Text3
Height = 345
Left = 3540
TabIndex = 10
Text = "Text3"
Top = 780
Width = 1545
End
Begin VB.TextBox Text2
Height = 345
Left = 3540
TabIndex = 9
Text = "Text2"
Top = 300
Width = 1545
End
Begin VB.Label Label6
Caption = "成绩:"
Height = 285
Left = 2850
TabIndex = 8
Top = 810
Width = 765
End
Begin VB.Label Label5
Caption = "课程:"
Height = 285
Left = 360
TabIndex = 7
Top = 840
Width = 585
End
Begin VB.Label Label4
Caption = "专业:"
Height = 315
Left = 5280
TabIndex = 6
Top = 330
Width = 765
End
Begin VB.Label Label3
Caption = "姓名:"
Height = 255
Left = 2880
TabIndex = 5
Top = 330
Width = 615
End
Begin VB.Label Label2
Caption = "学号:"
Height = 285
Left = 360
TabIndex = 4
Top = 330
Width = 675
End
End
End
Begin VB.CommandButton Command1
Caption = "退出成绩"
Height = 345
Left = 7740
TabIndex = 1
Top = 150
Width = 1185
End
Begin VB.Line Line1
BorderColor = &H80000015&
X1 = -30
X2 = 9570
Y1 = 540
Y2 = 540
End
Begin VB.Label Label1
Caption = "成绩管理"
BeginProperty Font
Name = "黑体"
Size = 15.75
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H80000015&
Height = 345
Left = 3990
TabIndex = 0
Top = 120
Width = 1545
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cmdadd_Click()
Adodc4.Recordset.AddNew
DataCombo3.SetFocus
End Sub
Private Sub cmdedit_Click()
Dim sql As String
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc2.CommandType = adCmdText
sql = "select * from score"
Adodc2.RecordSource = sql
Adodc2.Recordset.Update
Set DataGrid2.DataSource = Adodc2
DataGrid2.Refresh
Set Text6.DataSource = Adodc2
Set Text7.DataSource = Adodc2
Set Text8.DataSource = Adodc2
Set Text9.DataSource = Adodc2
Set Text10.DataSource = Adodc2
Text6.DataField = "学号"
Text7.DataField = "姓名"
Text8.DataField = "成绩专业"
Text9.DataField = "课程名称"
Text10.DataField = "成绩"
If cmdedit.Caption = "修改" Then
cmdedit.Caption = "确认修改"
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
Text9.Enabled = True
Text10.Enabled = True
Adodc2.Recordset.Fields(0) = Text6.Text
Adodc2.Recordset.Fields(1) = Text7.Text
Adodc2.Recordset.Fields(2) = Text8.Text
Adodc2.Recordset.Fields(3) = Text9.Text
Adodc2.Recordset.Fields(4) = Text10.Text
Else
cmdedit.Caption = "修改"
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
End If
End Sub
Private Sub cmdfind_Click()
Dim sql As String
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc2.CommandType = adCmdText
If Option1.Value = True Then
sql = "select * from score where 学号='" & Text4.Text & "'"
End If
If Option2.Value = True Then
sql = "select * from score where 姓名 ='" & Text5.Text & "'"
End If
Adodc2.RecordSource = sql
Adodc2.Refresh
Set DataGrid2.DataSource = Adodc2
DataGrid2.Refresh
Set Text6.DataSource = Adodc2
Set Text7.DataSource = Adodc2
Set Text8.DataSource = Adodc2
Set Text9.DataSource = Adodc2
Set Text10.DataSource = Adodc2
Text6.DataField = "学号"
Text7.DataField = "姓名"
Text8.DataField = "成绩专业"
Text9.DataField = "课程名称"
Text10.DataField = "成绩"
End Sub
Private Sub cmdrall_Click()
Set DataGrid2.DataSource = Adodc2
Set Text6.DataSource = Adodc2
Set Text7.DataSource = Adodc2
Set Text8.DataSource = Adodc2
Set Text9.DataSource = Adodc2
Set Text10.DataSource = Adodc2
Text6.DataField = "学号"
Text7.DataField = "姓名"
Text8.DataField = "成绩专业"
Text9.DataField = "课程名称"
Text10.DataField = "成绩"
Adodc2.Recordset.Fields(0) = Text6.Text
Adodc2.Recordset.Fields(1) = Text7.Text
Adodc2.Recordset.Fields(2) = Text8.Text
Adodc2.Recordset.Fields(3) = Text9.Text
Adodc2.Recordset.Fields(4) = Text10.Text
Adodc2.Refresh
Adodc4.Refresh
Adodc2.RecordSource = "select * from class"
DataGrid2.Refresh
DataGrid1.Refresh
End Sub
Private Sub cmdsave_Click()
Adodc4.Recordset.Fields(0) = DataCombo3.Text
Adodc4.Recordset.Fields(1) = Text2.Text
Adodc4.Recordset.Fields(2) = DataCombo1.Text
Adodc4.Recordset.Fields(3) = DataCombo2.Text
Adodc4.Recordset.Fields(4) = Text3.Text
Adodc4.Recordset.Update
DataGrid1.Refresh
End Sub
Private Sub Command1_Click()
Adodc1.Recordset.Close
Adodc3.Recordset.Close
Adodc4.Recordset.Close
Unload Me
End Sub
Private Sub Command2_Click()
DataReport2.Show
End Sub
Private Sub Command3_Click()
DataReport2.PrintReport
End Sub
Private Sub Form_Load()
Dim sql As String
Dim sorce As String
Dim kc As String
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc1.CommandType = adCmdText
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc3.CommandType = adCmdText
Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc4.CommandType = adCmdText
sql = "select * from student"
sorce = "select * from score"
kc = "select * from kc"
Adodc3.RecordSource = kc
Adodc4.RecordSource = sorce
Adodc1.RecordSource = sql
Set DataGrid1.DataSource = Adodc4
Set DataGrid3.DataSource = Adodc4
Set DataCombo3.DataSource = Adodc4
Set Text2.DataSource = Adodc4
Set DataCombo1.DataSource = Adodc4
Set DataCombo2.DataSource = Adodc4
Set Text3.DataSource = Adodc4
DataCombo3.DataField = "学号"
Text2.DataField = "姓名"
DataCombo1.DataField = "成绩专业"
DataCombo2.DataField = "课程名称"
Text3.DataField = "成绩"
Set DataCombo1.RowSource = Adodc3
Set DataCombo2.RowSource = Adodc3
DataCombo1.ListField = "所属专业"
DataCombo2.ListField = "课程名称"
Set DataCombo3.RowSource = Adodc1
DataCombo3.ListField = "学号"
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
Text9.Enabled = False
Text10.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -