📄 course.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 frmcourse
Caption = "课程信息管理"
ClientHeight = 2220
ClientLeft = 60
ClientTop = 420
ClientWidth = 6495
LinkTopic = "Form1"
ScaleHeight = 2220
ScaleWidth = 6495
StartUpPosition = 3 'Windows Default
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 2040
Top = 840
Visible = 0 'False
Width = 2415
_ExtentX = 4260
_ExtentY = 582
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 = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "course.frx":0000
Height = 255
Left = 480
TabIndex = 8
Top = 1920
Visible = 0 'False
Width = 5535
_ExtentX = 9763
_ExtentY = 450
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
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.CommandButton Command4
Caption = "退出"
Height = 495
Left = 5040
TabIndex = 7
Top = 1320
Width = 1095
End
Begin VB.TextBox Text1
Height = 375
Left = 1200
TabIndex = 4
Text = "Text1"
Top = 360
Width = 1575
End
Begin VB.TextBox Text2
Height = 375
Left = 4200
TabIndex = 3
Text = "Text2"
Top = 360
Width = 1815
End
Begin VB.CommandButton Command1
Caption = "添加课程"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 360
TabIndex = 2
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command2
Caption = "删除课程"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1920
TabIndex = 1
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command3
Caption = "查询信息"
BeginProperty Font
Name = "MS Sans Serif"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 3480
TabIndex = 0
Top = 1320
Width = 1095
End
Begin VB.Label Label1
Caption = "课程编号:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 6
Top = 360
Width = 1215
End
Begin VB.Label Label2
Caption = "课程名称:"
BeginProperty Font
Name = "MS Sans Serif"
Size = 12
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2880
TabIndex = 5
Top = 360
Width = 1215
End
End
Attribute VB_Name = "frmcourse"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As ADODB.Connection
Dim cmd As ADODB.Command
Dim ret As ADODB.Recordset
Dim strcnn As String
Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim dQuery As DAO.QueryDef
'添加课程
Private Sub Command1_Click()
strcnn = "User ID=Admin;Password=;Data Source=" & App.Path & "\db.mdb;Provider=Microsoft.Jet.OLEDB.3.51"
Set cnn = New ADODB.Connection
cnn.Open strcnn
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
'此处需要修改
cmd.CommandText = "insert into 课程信息表 values('" + Text1.Text + "','" + Text2.Text + "')"
cmd.Execute
cnn.Close
MsgBox ("添加课程成功!!")
End Sub
'删除课程
Private Sub Command2_Click()
Dim isdelete As Integer
isdelete = MsgBox("确实要删除吗?", vbExclamation + vbDefaultButton1 + vbYesNo, "提示信息")
If isdelete Then
strcnn = "User ID=Admin;Password=;Data Source=" & App.Path & "\db.mdb;Provider=Microsoft.Jet.OLEDB.3.51"
Set cnn = New ADODB.Connection
cnn.Open strcnn
Set cmd = New ADODB.Command
cmd.ActiveConnection = cnn
cmd.CommandText = "delete from 课程信息表 where 课程号=val('" + Text1.Text + "')"
cmd.Execute
cnn.Close
MsgBox ("删除成功!!")
End If
End Sub
'课程信息查询
Private Sub Command3_Click()
Set db = OpenDatabase(App.Path & "\db.mdb")
Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from 课程信息表"
Adodc1.Refresh
frmcourse.Height = 8000
DataGrid1.Visible = True
DataGrid1.Height = 4000
DataGrid1.Columns(0).Width = 1000
DataGrid1.Columns(1).Width = 1000
End Sub
'退出
Private Sub Command4_Click()
Me.Hide
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -