📄 frmbooksort.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Begin VB.Form frmbooksort
BorderStyle = 3 'Fixed Dialog
Caption = "图书分类"
ClientHeight = 3495
ClientLeft = 45
ClientTop = 330
ClientWidth = 5745
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 3495
ScaleWidth = 5745
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.CommandButton Command3
Caption = "添加新类别"
Height = 375
Left = 405
TabIndex = 12
Top = 2940
Width = 1395
End
Begin VB.CommandButton Command5
Caption = "删除旧类别"
Height = 375
Left = 2130
TabIndex = 11
Top = 2940
Width = 1395
End
Begin VB.CommandButton Command6
Caption = "关 闭"
Height = 375
Left = 3825
TabIndex = 10
Top = 2940
Width = 1395
End
Begin VB.Frame Frame1
Caption = "图书分类信息"
Height = 1380
Left = 120
TabIndex = 0
Top = 120
Width = 5475
Begin MSComCtl2.DTPicker DTPicker1
Height = 270
Left = 3795
TabIndex = 4
Top = 855
Width = 1320
_ExtentX = 2328
_ExtentY = 476
_Version = 393216
Format = 19791873
CurrentDate = 38313
End
Begin VB.TextBox Text3
Height = 270
Left = 3795
TabIndex = 3
Top = 330
Width = 1320
End
Begin VB.TextBox Text2
Height = 270
Left = 1200
TabIndex = 2
Top = 900
Width = 1320
End
Begin VB.TextBox Text1
Height = 270
Left = 1200
TabIndex = 1
Top = 345
Width = 1320
End
Begin VB.Label Label4
Caption = "登记日期:"
Height = 255
Left = 2775
TabIndex = 8
Top = 915
Width = 975
End
Begin VB.Label Label3
Caption = "规定天数:"
Height = 255
Left = 2685
TabIndex = 7
Top = 330
Width = 975
End
Begin VB.Label Label2
Caption = "书籍类别:"
Height = 255
Left = 240
TabIndex = 6
Top = 960
Width = 975
End
Begin VB.Label Label1
Caption = "类别代码:"
Height = 255
Left = 240
TabIndex = 5
Top = 330
Width = 975
End
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "frmbooksort.frx":0000
Height = 1200
Left = 135
TabIndex = 9
Top = 1560
Width = 5460
_ExtentX = 9631
_ExtentY = 2117
_Version = 393216
HeadLines = 1
RowHeight = 15
FormatLocked = -1 'True
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 4
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
BeginProperty Column02
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 Column03
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
ColumnWidth = 2085.166
EndProperty
BeginProperty Column01
ColumnWidth = 2085.166
EndProperty
BeginProperty Column02
ColumnWidth = 2085.166
EndProperty
BeginProperty Column03
ColumnWidth = 2085.166
EndProperty
EndProperty
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 3060
Top = 330
Visible = 0 'False
Width = 1575
_ExtentX = 2778
_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 = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=tsgl"
OLEDBString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=tsgl"
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from lbtb"
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
End
Attribute VB_Name = "frmbooksort"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs As ADODB.Recordset
Private Sub Command3_Click()
If Text1.Text = "" Then
MsgBox "系统不允许类别编号为空!", , "信息提示"
Exit Sub
End If
Set rs = cnn.Execute("insert into lbtb values('" & Text1 & "','" & Text2 & "','" & Text3 & "','" & DTPicker1 & "')")
Adodc1.Refresh
Text1.Text = ""
Text2.Text = ""
Text3.Text = ""
End Sub
Private Sub Command5_Click()
On Error Resume Next
If Adodc1.Recordset.EOF = False Then
c = MsgBox("您确认要删除该记录吗?", 17, "信息提示")
If c = vbOK Then
Adodc1.Recordset.Delete
Adodc1.Refresh
Else
End If
Else
MsgBox "当前数据库中已经没有可删除的记录", 64, "信息提示"
End If
End Sub
Private Sub Command6_Click()
Set rs = Nothing
Unload Me
End Sub
Private Sub DataGrid1_DblClick()
If Adodc1.Recordset.RecordCount > 0 Then
With Adodc1.Recordset
Text1.Text = .Fields(0)
Text2.Text = .Fields(1)
Text3.Text = .Fields(2)
DTPicker1.Value = .Fields(3)
frmbooksort1.Show 1
End With
Else
MsgBox "没有数据,请您添加数据!", vbOKOnly, "提示"
End If
End Sub
Private Sub Form_Activate()
Text1.SetFocus
End Sub
Private Sub Form_Load()
Set rs = New ADODB.Recordset
rs.Open "select * from lbtb", cnn, adOpenStatic, adLockOptimistic
DTPicker1.Value = Date
Me.Caption = Me.Caption & " " & frmmain.StatusBar1.Panels(2).Text
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text3.SetFocus
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then DTPicker1.SetFocus
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -