📄 formreadermanage.frm
字号:
Left = 1560
TabIndex = 4
ToolTipText = "最后一条记录"
Top = 4080
Width = 495
End
Begin VB.CommandButton cmdNext
Caption = "4"
BeginProperty Font
Name = "Webdings"
Size = 14.25
Charset = 2
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 1080
TabIndex = 3
ToolTipText = "下一条记录"
Top = 4080
Width = 495
End
Begin VB.CommandButton cmdPrevious
Caption = "3"
BeginProperty Font
Name = "Webdings"
Size = 14.25
Charset = 2
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 600
TabIndex = 2
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 = 1
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 = 0
Top = 4080
Width = 1215
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 dgReader
Bindings = "formreadermanage.frx":0016
Height = 3975
Left = 120
TabIndex = 9
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 = "frmreadermanage"
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)
txtReaderID.Text = ""
txtReaderName.Text = ""
Cmbgender.Text = ""
txtPhoneNO.Text = ""
txtCollege.Text = ""
txtDesc.Text = ""
cmdSave.Enabled = False
End Sub
Private Sub cmdAdd_Click()
strReaderID = Replace(Trim(txtReaderID.Text), "'", "")
strReaderName = Replace(Trim(txtReaderName.Text), "'", "")
strgender = Replace(Trim(Cmbgender.Text), "'", "")
strPhoneNO = Replace(Trim(txtPhoneNO.Text), "'", "")
strCollege = Replace(Trim(txtCollege.Text), "'", "")
If strReaderID = "" Then
MsgBox "读者编号不能为空!", , "输入错误"
txtReaderID.SetFocus
Exit Sub
ElseIf strReaderName = "" Then
MsgBox "姓名不能为空!", , "输入错误"
txtReaderName.SetFocus
Exit Sub
ElseIf strgender = "" Then
MsgBox "性别不能为空!", , "输入错误"
Cmbgender.SetFocus
Exit Sub
ElseIf strPhoneNO = "" Then
MsgBox "电话不能为空!", , "输入错误"
txtPhoneNO.SetFocus
Exit Sub
ElseIf strCollege = "" Then
MsgBox "单位不能为空!", , "输入错误"
txtCollege.SetFocus
Exit Sub
End If
Adodc2.RecordSource = "select * from 读者 where 读者编号 = '" & txtReaderID.Text & "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount <> 0 Then
MsgBox "该读者编号已经存在,请重新输入!"
txtReaderID.Text = ""
Exit Sub
End If
BookMK = Adodc1.Recordset.Bookmark
Adodc1.Recordset.AddNew
Adodc1.Recordset.Fields(0).Value = txtReaderID.Text
Adodc1.Recordset.Fields(1).Value = txtReaderName.Text
Adodc1.Recordset.Fields(2).Value = Cmbgender.Text
Adodc1.Recordset.Fields(3).Value = txtPhoneNO.Text
Adodc1.Recordset.Fields(4).Value = txtCollege.Text
cmdSave.Enabled = False
Adodc1.Recordset.Update
Adodc1.Recordset.Bookmark = BookMK
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
txtReaderID.Text = Adodc1.Recordset.Fields(0).Value
txtReaderName.Text = Adodc1.Recordset.Fields(1).Value
Cmbgender.Text = Adodc1.Recordset.Fields(2).Value
txtPhoneNO.Text = Adodc1.Recordset.Fields(3).Value
txtCollege.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()
Adodc2.RecordSource = "select * from 读者 where 读者编号 = '" & txtReaderID.Text & "'"
Adodc2.Refresh
If Adodc2.Recordset.RecordCount <> 0 Then
MsgBox "该读者编号已经存在,请重新输入!"
txtReaderID.Text = ""
Exit Sub
End If
Adodc1.Recordset.Fields(0).Value = txtReaderID.Text
Adodc1.Recordset.Fields(1).Value = txtReaderName.Text
Adodc1.Recordset.Fields(2).Value = Cmbgender.Text
Adodc1.Recordset.Fields(3).Value = txtPhoneNO.Text
Adodc1.Recordset.Fields(4).Value = txtCollege.Text
Adodc1.Recordset.Update
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
Adodc2.ConnectionString = "Provider=Microsoft.Jet.oledb.4.0;Data Source=" & App.Path & "\图书管理系统.mdb;Persist Security Info=False"
With dgReader
.Columns(0).Width = 2800
.Columns(1).Width = 2800
.Columns(2).Width = 1400
.Columns(3).Width = 3500
.Columns(4).Width = 3500
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -