📄 class.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 frmclass
Caption = "班级管理"
ClientHeight = 2490
ClientLeft = 60
ClientTop = 420
ClientWidth = 6195
LinkTopic = "Form1"
ScaleHeight = 2490
ScaleWidth = 6195
StartUpPosition = 3 'Windows Default
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "class.frx":0000
Height = 1095
Left = 720
TabIndex = 8
Top = 2280
Visible = 0 'False
Width = 4815
_ExtentX = 8493
_ExtentY = 1931
_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 MSAdodcLib.Adodc Adodc1
Height = 330
Left = 960
Top = 1200
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 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 = 3360
TabIndex = 5
Top = 1560
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 = 1800
TabIndex = 4
Top = 1560
Width = 1095
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 = 240
TabIndex = 3
Top = 1560
Width = 1095
End
Begin VB.TextBox Text2
BackColor = &H00FFFFFF&
Height = 375
Left = 4080
TabIndex = 2
Text = "Text2"
Top = 600
Width = 1815
End
Begin VB.TextBox Text1
Height = 375
Left = 1080
TabIndex = 1
Text = "Text1"
Top = 600
Width = 1575
End
Begin VB.CommandButton Command4
Caption = "退出"
Height = 495
Left = 4920
TabIndex = 0
Top = 1560
Width = 1095
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 = 2760
TabIndex = 7
Top = 600
Width = 1215
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 = 0
TabIndex = 6
Top = 600
Width = 1215
End
End
Attribute VB_Name = "frmclass"
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
frmclass.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 + -