📄 addeditreader.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form addeditreader
Caption = "编辑读者信息"
ClientHeight = 5235
ClientLeft = 60
ClientTop = 345
ClientWidth = 7050
BeginProperty Font
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
LinkTopic = "Form1"
ScaleHeight = 5235
ScaleWidth = 7050
StartUpPosition = 2 'CenterScreen
Begin MSAdodcLib.Adodc Adodc2
Height = 330
Left = 5040
Top = 4920
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_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 = "driver={sql server};server=localhost;database=library_mis;uid=sa;pwd="
OLEDBString = "driver={sql server};server=localhost;database=library_mis;uid=sa;pwd="
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select * from readertype"
Caption = "Adodc2"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSAdodcLib.Adodc Adodc1
Height = 330
Left = 5040
Top = 4440
Visible = 0 'False
Width = 1935
_ExtentX = 3413
_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 = "driver={sql server};server=localhost;database=library_mis;uid=sa;pwd="
OLEDBString = "driver={sql server};server=localhost;database=library_mis;uid=sa;pwd="
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = "select distinct readerdept from readers"
Caption = "Adodc1"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9.75
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.CommandButton cmdcancel
Caption = "取消"
Height = 495
Left = 3600
TabIndex = 18
Top = 4560
Width = 855
End
Begin VB.CommandButton cmdok
Caption = "确定"
Height = 495
Left = 2040
TabIndex = 17
Top = 4560
Width = 855
End
Begin VB.Frame Frame1
Caption = "读者信息"
Height = 4095
Left = 240
TabIndex = 0
Top = 240
Width = 6495
Begin MSDataListLib.DataCombo DataCombo1
Bindings = "addeditreader.frx":0000
Height = 345
Left = 2880
TabIndex = 19
Top = 1200
Width = 1935
_ExtentX = 3413
_ExtentY = 609
_Version = 393216
ListField = "readerdept"
Text = ""
End
Begin VB.TextBox txtdate
Height = 375
Left = 1320
TabIndex = 16
Top = 3600
Width = 1455
End
Begin VB.Frame Frame3
Caption = "级别*"
Height = 1455
Left = 360
TabIndex = 9
Top = 1920
Width = 5775
Begin VB.TextBox txtfine
Height = 375
Left = 960
TabIndex = 22
Top = 960
Width = 855
End
Begin MSDataListLib.DataCombo DataCombo2
Bindings = "addeditreader.frx":0015
Height = 345
Left = 240
TabIndex = 20
Top = 360
Width = 1455
_ExtentX = 2566
_ExtentY = 609
_Version = 393216
ListField = "typename"
Text = ""
End
Begin VB.CommandButton cmdadd
Caption = "添加"
Height = 375
Left = 1920
TabIndex = 14
Top = 360
Width = 615
End
Begin VB.TextBox txtbookdays
Height = 405
Left = 4680
TabIndex = 13
Top = 960
Width = 975
End
Begin VB.TextBox txtbooknum
Height = 405
Left = 2760
TabIndex = 11
Top = 960
Width = 855
End
Begin VB.Label Label7
Caption = "罚款金额"
Height = 255
Left = 120
TabIndex = 21
Top = 1080
Width = 975
End
Begin VB.Label Label5
Caption = "借书期限"
Height = 255
Left = 3840
TabIndex = 12
Top = 1080
Width = 1215
End
Begin VB.Label Label4
Caption = "借书总数"
Height = 255
Left = 1920
TabIndex = 10
Top = 1080
Width = 855
End
End
Begin VB.Frame Frame2
Caption = "性别"
Height = 735
Left = 360
TabIndex = 5
Top = 960
Width = 1335
Begin VB.OptionButton opt2
Caption = "女"
Height = 195
Index = 1
Left = 720
TabIndex = 7
Top = 360
Width = 495
End
Begin VB.OptionButton opt1
Caption = "男"
Height = 195
Index = 0
Left = 120
TabIndex = 6
Top = 360
Width = 495
End
End
Begin VB.TextBox txtreaderid
Height = 405
Left = 1320
TabIndex = 2
Top = 360
Width = 2415
End
Begin VB.TextBox txtreadername
Height = 375
Left = 4560
TabIndex = 1
Top = 360
Width = 1455
End
Begin VB.Label Label6
Caption = "登记日期*"
Height = 255
Left = 360
TabIndex = 15
Top = 3720
Width = 1095
End
Begin VB.Label Label3
Caption = "学院/系"
Height = 255
Left = 2040
TabIndex = 8
Top = 1320
Width = 855
End
Begin VB.Label Label1
Caption = "读者编号*"
Height = 255
Left = 360
TabIndex = 4
Top = 480
Width = 975
End
Begin VB.Label Label2
Caption = "姓名*"
Height = 255
Left = 3960
TabIndex = 3
Top = 480
Width = 615
End
End
End
Attribute VB_Name = "addeditreader"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim mrc As ADODB.Recordset
Dim txtsql, msgtext As String
Private Sub cmdadd_Click()
flag2 = 1
addedittype.Show vbModal
End Sub
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdok_Click()
If Trim(txtreaderid.Text) = "" Or Trim(txtreadername.Text) = "" Or Trim(DataCombo2.Text) = "" Then
MsgBox "加*数据项不能为空!", vbOKOnly + vbExclamation, "信息提示"
Exit Sub
End If
If flag = 1 Then
txtsql = "select * from readers where readerid='" & Trim(txtreaderid) & "'"
Set mrc = ExecuteSQL(txtsql, msgtext)
If mrc.EOF = False Then
MsgBox "存在相同的借书证号!", vbOKOnly + vbExclamation, "信息提示"
txtreaderid.SetFocus
mrc.Close
Exit Sub
Else
mrc.Close
End If
editborrower.Adodc1.Recordset.AddNew
editborrower.Adodc1.Recordset.Fields("readerid") = Trim(txtreaderid.Text)
editborrower.Adodc1.Recordset.Fields("readername") = Trim(txtreadername.Text)
If opt1(0).Value = True Then
editborrower.Adodc1.Recordset.Fields("readersex") = "m"
Else
editborrower.Adodc1.Recordset.Fields("readersex") = "f"
End If
editborrower.Adodc1.Recordset.Fields("readertype") = Trim(DataCombo2.Text)
editborrower.Adodc1.Recordset.Fields("readerdept") = Trim(DataCombo1.Text)
editborrower.Adodc1.Recordset.Fields("fine") = Trim(txtfine.Text)
editborrower.Adodc1.Recordset.Fields("booknum") = Trim(txtbooknum.Text)
editborrower.Adodc1.Recordset.Fields("bookdays") = Trim(txtbookdays.Text)
editborrower.Adodc1.Recordset.Fields("boralready") = 0
editborrower.Adodc1.Recordset.Fields("checkdate") = Format(Trim(txtdate.Text), "yyyy-mm-dd")
editborrower.Adodc1.Recordset.Update
Else
editborrower.Adodc1.Recordset.Fields("readername") = Trim(txtreadername.Text)
If opt1(0).Value = True Then
editborrower.Adodc1.Recordset.Fields("readersex") = "m"
Else
editborrower.Adodc1.Recordset.Fields("readersex") = "f"
End If
editborrower.Adodc1.Recordset.Fields("readertype") = Trim(DataCombo2.Text)
editborrower.Adodc1.Recordset.Fields("readerdept") = Trim(DataCombo1.Text)
editborrower.Adodc1.Recordset.Fields("fine") = Trim(txtfine.Text)
editborrower.Adodc1.Recordset.Fields("booknum") = Trim(txtbooknum.Text)
editborrower.Adodc1.Recordset.Fields("bookdays") = Trim(txtbookdays.Text)
editborrower.Adodc1.Recordset.Fields("boralready") = 0
editborrower.Adodc1.Recordset.Fields("checkdate") = Format(Trim(txtdate.Text), "yyyy-mm-dd")
editborrower.Adodc1.Recordset.Update
End If
Unload Me
End Sub
Private Sub DataCombo2_LostFocus()
If Adodc2.Recordset.EOF = False Then
If Trim(DataCombo2.Text) <> "" Then
Adodc2.Recordset.MoveFirst
Adodc2.Recordset.Find ("typename='" & Trim(DataCombo2.Text) & "'")
txtbooknum.Text = Adodc2.Recordset.Fields("booknum")
txtbookdays.Text = Adodc2.Recordset.Fields("bookdays")
End If
Else
MsgBox "没有任何级别可选,请设置新级别!", vbOKOnly + vbExclamation, "信息提示"
End If
End Sub
Private Sub Form_Activate()
Adodc1.Refresh
Adodc2.Refresh
DataCombo1.Refresh
DataCombo2.Refresh
End Sub
Private Sub Form_Load()
If flag = 2 Then
txtreaderid.Text = editborrower.Adodc1.Recordset.Fields("readerid")
txtreadername.Text = editborrower.Adodc1.Recordset.Fields("readername")
If editborrower.Adodc1.Recordset.Fields("readersex") = "m" Then
opt1(0).Value = True
Else
opt2(1).Value = True
End If
DataCombo1.Text = editborrower.Adodc1.Recordset.Fields("readerdept")
DataCombo2.Text = editborrower.Adodc1.Recordset.Fields("readertype")
txtbooknum.Text = editborrower.Adodc1.Recordset.Fields("booknum")
txtbookdays.Text = editborrower.Adodc1.Recordset.Fields("bookdays")
txtdate.Text = editborrower.Adodc1.Recordset.Fields("checkdate")
txtfine.Text = editborrower.Adodc1.Recordset.Fields("fine")
txtreaderid.Enabled = False
Else
txtdate.Text = Date
txtfine.Text = "0"
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -