📄 formcoursemanage.frm
字号:
Size = 14.25
Charset = 2
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 3
ToolTipText = "上一条记录"
Top = 4080
Width = 495
End
Begin VB.CommandButton cmdFirst
Caption = "9"
BeginProperty Font
Name = "Webdings"
Size = 14.25
Charset = 2
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 2
ToolTipText = "第一条记录"
Top = 4080
Width = 495
End
Begin VB.CommandButton cmdSave
Caption = "保存(&S)"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 11640
TabIndex = 1
Top = 4080
Width = 1215
End
Begin VB.CommandButton Command6
Caption = "退出(&Q)"
BeginProperty Font
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 12960
TabIndex = 0
Top = 4080
Width = 1215
End
Begin MSAdodcLib.Adodc Adodc2
Height = 375
Left = 0
Top = 8040
Visible = 0 'False
Width = 4935
_ExtentX = 8705
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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 MSAdodcLib.Adodc Adodc1
Height = 375
Left = 0
Top = 8040
Visible = 0 'False
Width = 4935
_ExtentX = 8705
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 1
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 MSDataGridLib.DataGrid dgBook
Bindings = "formcoursemanage.frx":0000
Height = 3975
Left = 120
TabIndex = 10
Top = 0
Width = 14055
_ExtentX = 24791
_ExtentY = 7011
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 22
AllowAddNew = -1 'True
AllowDelete = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 14.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "图书信息"
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
End
Attribute VB_Name = "frmbookmanage"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Adodc1_RecordsetChangeComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
txtBookID.Text = ""
txtBookName.Text = ""
txtPrice.Text = ""
txtPress.Text = ""
txtWriter.Text = ""
txtDesc.Text = ""
cmdSave.Enabled = False
End Sub
Private Sub cmdAdd_Click()
strBookID = Replace(Trim(txtBookID.Text), "'", "")
strBookName = Replace(Trim(txtBookName.Text), "'", "")
strPress = Replace(Trim(txtPress.Text), "'", "")
strWriter = Replace(Trim(txtWriter.Text), "'", "")
intPrice = Val(txtPrice.Text)
strDesc = Replace(Trim(txtDesc.Text), "'", "")
If strBookID = "" Then
MsgBox "图书编号不能为空!", , "输入错误"
txtBookID.SetFocus
Exit Sub
ElseIf strBookName = "" Then
MsgBox "书名不能为空!", , "输入错误"
txtBookName.SetFocus
Exit Sub
ElseIf strPress = "" Then
MsgBox "出版社不能为空!", , "输入错误"
txtPress.SetFocus
Exit Sub
ElseIf strWriter = "" Then
MsgBox "作者不能为空!", , "输入错误"
txtWriter.SetFocus
Exit Sub
ElseIf intPrice = 0 Then
MsgBox "价格不能为空!", , "输入错误"
txtPrice.SetFocus
Exit Sub
End If
Adodc3.RecordSource = "select * from 图书 where 图书编号 = '" & txtBookID.Text & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount <> 0 Then
MsgBox "该图书编号已经存在,请重新输入!"
txtBookID.Text = ""
Exit Sub
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0).Value = txtBookID.Text
Adodc1.Recordset.Fields(1).Value = txtBookName.Text
Adodc1.Recordset.Fields(2).Value = txtPress.Text
Adodc1.Recordset.Fields(3).Value = txtWriter.Text
Adodc1.Recordset.Fields(4).Value = txtPrice.Text
cmdSave.Enabled = False
Adodc1.Recordset.Update
End Sub
Private Sub cmdDelete_Click()
cmdSave.Enabled = False
ss$ = MsgBox("是否真的要删除?", vbInformation + vbOKOnly + vbOKCancel, "提示")
If ss$ = 1 Then
Adodc1.Recordset.Delete
Else: Exit Sub
End If
End Sub
Private Sub cmdFirst_Click()
Adodc1.Recordset.MoveFirst
End Sub
Private Sub cmdLast_Click()
Adodc1.Recordset.MoveLast
End Sub
Private Sub cmdModify_Click()
If Not Adodc1.Recordset.EOF And Not Adodc1.Recordset.BOF Then
txtBookID.Text = Adodc1.Recordset.Fields(0).Value
txtBookName.Text = Adodc1.Recordset.Fields(1).Value
txtPress.Text = Adodc1.Recordset.Fields(2).Value
txtWriter.Text = Adodc1.Recordset.Fields(3).Value
txtPrice.Text = Adodc1.Recordset.Fields(4).Value
cmdSave.Enabled = True
End If
End Sub
Private Sub cmdNext_Click()
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
Else
Adodc1.Recordset.MoveNext
If Adodc1.Recordset.EOF Then
Adodc1.Recordset.MoveFirst
End If
End If
End Sub
Private Sub cmdPrevious_Click()
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
Else
Adodc1.Recordset.MovePrevious
If Adodc1.Recordset.BOF Then
Adodc1.Recordset.MoveLast
End If
End If
End Sub
Private Sub cmdQuit_Click()
Unload Me
End Sub
Private Sub cmdSave_Click()
Adodc3.RecordSource = "select * from 图书 where 图书编号 = '" & txtBookID.Text & "'"
Adodc3.Refresh
If Adodc3.Recordset.RecordCount <> 0 Then
MsgBox "该图书编号已经存在,请重新输入!"
txtBookID.Text = ""
Exit Sub
End If
Adodc1.Recordset.Fields(0).Value = txtBookID.Text
Adodc1.Recordset.Fields(1).Value = txtBookName.Text
Adodc1.Recordset.Fields(2).Value = txtPress.Text
Adodc1.Recordset.Fields(3).Value = txtWriter.Text
Adodc1.Recordset.Fields(4).Value = txtPrice.Text
Adodc1.Recordset.Update
cmdSave.Enabled = False
End Sub
Private Sub DataGrid1_Click()
End Sub
Private Sub Form_Load()
Adodc1.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & "\图书管理系统.mdb;Persist Security Info=False"
Adodc1.RecordSource = "select * from 图书"
Adodc1.Refresh
Adodc3.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & "\图书管理系统.mdb;Persist Security Info=False"
End Sub
Private Sub bookaddnew()
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -