📄 form6.frm
字号:
Caption = "保存"
Height = 315
Left = 7035
TabIndex = 40
Top = 255
Width = 990
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "Form6.frx":0054
Left = 3960
List = "Form6.frx":0067
TabIndex = 36
Text = "Combo1"
Top = 255
Width = 1635
End
Begin VB.TextBox Text1
Height = 345
Left = 1350
TabIndex = 5
Text = "Text1"
Top = 300
Width = 1545
End
Begin VB.CommandButton comadd
Caption = "添加"
Height = 315
Left = 5790
TabIndex = 4
Top = 270
Width = 1095
End
Begin VB.Label Label2
Caption = "专业名称"
Height = 315
Left = 330
TabIndex = 7
Top = 360
Width = 915
End
Begin VB.Label Label3
Caption = "所属院系"
Height = 285
Left = 3120
TabIndex = 6
Top = 360
Width = 795
End
End
Begin VB.Frame Frame7
Caption = "课程信息"
Height = 825
Left = -74700
TabIndex = 19
Top = 2190
Width = 8295
Begin VB.CommandButton cdmnew
Caption = "刷新"
Height = 345
Left = 7170
TabIndex = 43
Top = 225
Width = 840
End
Begin VB.CommandButton cmdrchange
Caption = "修改"
Height = 345
Left = 6075
TabIndex = 31
Top = 225
Width = 870
End
Begin VB.TextBox Text14
Height = 315
Left = 4110
TabIndex = 30
Top = 240
Width = 1635
End
Begin VB.TextBox Text13
Height = 315
Left = 1290
TabIndex = 29
Top = 240
Width = 1635
End
Begin VB.Label Label15
Caption = "所属专业"
Height = 285
Left = 3270
TabIndex = 28
Top = 300
Width = 765
End
Begin VB.Label Label14
Caption = "课程名称"
Height = 285
Left = 360
TabIndex = 27
Top = 300
Width = 825
End
End
End
Begin VB.Label Label13
Caption = "所属院系"
Height = 285
Left = 3810
TabIndex = 26
Top = 3240
Width = 795
End
Begin VB.Label Label12
Caption = "专业名称"
Height = 285
Left = 930
TabIndex = 25
Top = 3270
Width = 885
End
Begin VB.Line Line1
BorderColor = &H80000015&
X1 = 0
X2 = 9540
Y1 = 570
Y2 = 570
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 = 405
Left = 3870
TabIndex = 1
Top = 150
Width = 1485
End
End
Attribute VB_Name = "Form6"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub cdmnew_Click()
Set DataGrid4.DataSource = Adodc4
Set Text13.DataSource = Adodc4
Set Text14.DataSource = Adodc4
Text13.DataField = "课程名称"
Text14.DataField = "所属专业"
Adodc4.Recordset.Fields(0) = Text13.Text
Adodc4.Recordset.Fields(1) = Text14.Text
Adodc4.Refresh
Adodc2.Refresh
Adodc4.RecordSource = "select * from kc"
DataGrid4.Refresh
DataGrid2.Refresh
End Sub
Private Sub cmdchang_Click()
Dim sql As String
Adodc3.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc3.CommandType = adCmdText
sql = "select * from zy"
Adodc3.RecordSource = sql
Adodc3.Recordset.Update
Set DataGrid3.DataSource = Adodc3
DataGrid3.Refresh
Set Text11.DataSource = Adodc3
Set Text12.DataSource = Adodc3
Text11.DataField = "专业名称"
Text12.DataField = "所属院系"
If cmdchang.Caption = "修改" Then
cmdchang.Caption = "确认修改"
Text11.Enabled = True
Text12.Enabled = True
Adodc3.Recordset.Fields(0) = Text11.Text
Adodc3.Recordset.Fields(1) = Text12.Text
Else
cmdchang.Caption = "修改"
Text11.Enabled = False
Text12.Enabled = False
End If
End Sub
Private Sub cmdfind_Click()
Dim sql As String
Dim sorce As String
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
If Option1.Value = True Then
sql = "select * from zy where 专业名称='" & DataCombo3.Text & "'"
Adodc3.RecordSource = sql
Adodc3.Refresh
Set DataGrid3.DataSource = Adodc3
DataGrid3.Refresh
Set Text11.DataSource = Adodc3
Set Text12.DataSource = Adodc3
Text11.DataField = "专业名称"
Text12.DataField = "所属院系"
Else
If Option2.Value = True Then
sorce = "select * from kc where 课程名称 ='" & DataCombo4.Text & "'"
Adodc4.RecordSource = sorce
Adodc4.Refresh
Set DataGrid4.DataSource = Adodc4
DataGrid4.Refresh
Set Text13.DataSource = Adodc4
Set Text14.DataSource = Adodc4
Text13.DataField = "课程名称"
Text14.DataField = "所属专业"
End If
End If
End Sub
Private Sub cmdradd_Click()
Adodc2.Recordset.AddNew
Text5.SetFocus
End Sub
Private Sub cmdrchange_Click()
Dim sorce As String
Adodc4.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc4.CommandType = adCmdText
sorce = "select * from kc"
Adodc4.RecordSource = sorce
Adodc4.Recordset.Update
Set DataGrid4.DataSource = Adodc4
DataGrid4.Refresh
Set Text13.DataSource = Adodc4
Set Text14.DataSource = Adodc4
Text13.DataField = "课程名称"
Text14.DataField = "所属专业"
If cmdrchange.Caption = "修改" Then
cmdrchange.Caption = "确认修改"
Text13.Enabled = True
Text14.Enabled = True
Adodc4.Recordset.Fields(0) = Text13.Text
Adodc4.Recordset.Fields(1) = Text14.Text
Else
cmdrchange.Caption = "修改"
Text13.Enabled = False
Text14.Enabled = False
End If
End Sub
Private Sub cmdrnew_Click()
Set DataGrid3.DataSource = Adodc3
Set Text11.DataSource = Adodc3
Set Text12.DataSource = Adodc3
Text11.DataField = "专业名称"
Text12.DataField = "所属院系"
Adodc3.Recordset.Fields(0) = Text11.Text
Adodc3.Recordset.Fields(1) = Text12.Text
Adodc3.Refresh
Adodc1.Refresh
Adodc3.RecordSource = "select * from zy"
DataGrid3.Refresh
DataGrid1.Refresh
End Sub
Private Sub cmdrsave_Click()
Adodc2.Recordset.Fields(0) = Text5.Text
Adodc2.Recordset.Fields(1) = DataCombo1.Text
Adodc2.Recordset.Update
DataGrid2.Refresh
End Sub
Private Sub cmdsave_Click()
Adodc1.Recordset.Fields(0) = Text1.Text
Adodc1.Recordset.Fields(1) = Combo1.Text
Adodc1.Recordset.Update
DataGrid1.Refresh
End Sub
Private Sub comadd_Click()
Adodc1.Recordset.AddNew
Text1.SetFocus
End Sub
Private Sub Command8_Click()
End Sub
Private Sub Command1_Click()
Adodc1.Recordset.Close
Adodc2.Recordset.Close
Unload Me
End Sub
Private Sub Form_Load()
Dim sql As String
Dim sorce As String
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc1.CommandType = adCmdText
Adodc2.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb"
Adodc2.CommandType = adCmdText
sql = "select * from zy"
sorce = "select * from kc"
Adodc1.RecordSource = sql
Adodc2.RecordSource = sorce
Set DataGrid1.DataSource = Adodc1
Set DataGrid2.DataSource = Adodc2
Set Text1.DataSource = Adodc1
Set Combo1.DataSource = Adodc1
Text1.DataField = "专业名称"
Combo1.DataField = "所属院系"
Set Text5.DataSource = Adodc2
Set DataCombo1.DataSource = Adodc2
Text5.DataField = "课程名称"
DataCombo1.DataField = "所属专业"
Set DataCombo1.RowSource = Adodc1
Set DataCombo3.RowSource = Adodc1
DataCombo1.ListField = "专业名称"
DataCombo3.ListField = "专业名称"
Set DataCombo4.RowSource = Adodc2
DataCombo4.ListField = "课程名称"
Text11.Enabled = False
Text12.Enabled = False
Text13.Enabled = False
Text14.Enabled = False
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -