⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmcinfom.frm

📁 图书管理系统 asp+sql server 2000
💻 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 frmCInfoM 
   BackColor       =   &H00FFC0C0&
   Caption         =   "借阅证件信息管理"
   ClientHeight    =   5955
   ClientLeft      =   3300
   ClientTop       =   3015
   ClientWidth     =   12030
   LinkTopic       =   "Form1"
   ScaleHeight     =   5955
   ScaleWidth      =   12030
   Begin MSDataGridLib.DataGrid dtgCInfo 
      Bindings        =   "frmCInfoM.frx":0000
      Height          =   3615
      Left            =   2040
      TabIndex        =   8
      Top             =   480
      Width           =   8775
      _ExtentX        =   15478
      _ExtentY        =   6376
      _Version        =   393216
      BackColor       =   12632256
      HeadLines       =   1
      RowHeight       =   16
      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            =   10.5
         Charset         =   134
         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 VB.CommandButton cmdBack 
      Caption         =   "返回(&X)"
      Height          =   495
      Left            =   7440
      TabIndex        =   7
      Top             =   4680
      Width           =   1095
   End
   Begin VB.CommandButton cmdDel 
      Caption         =   "删除(&D)"
      Height          =   495
      Left            =   5880
      TabIndex        =   6
      Top             =   4680
      Width           =   1335
   End
   Begin VB.CommandButton cmdModi 
      Caption         =   "修改(&U)"
      Height          =   495
      Left            =   4440
      TabIndex        =   5
      Top             =   4680
      Width           =   1335
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加(&A)"
      Height          =   495
      Left            =   3000
      TabIndex        =   4
      Top             =   4680
      Width           =   1215
   End
   Begin VB.ListBox LstCType 
      BackColor       =   &H00FFC0C0&
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   1500
      Left            =   360
      TabIndex        =   3
      Top             =   2160
      Width           =   1455
   End
   Begin MSAdodcLib.Adodc adoCInfo 
      Height          =   615
      Left            =   360
      Top             =   4680
      Visible         =   0   'False
      Width           =   2175
      _ExtentX        =   3836
      _ExtentY        =   1085
      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            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.ComboBox cboStatus 
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   300
      ItemData        =   "frmCInfoM.frx":0017
      Left            =   480
      List            =   "frmCInfoM.frx":0027
      Style           =   2  'Dropdown List
      TabIndex        =   1
      Top             =   840
      Width           =   1335
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "证件类型"
      Height          =   375
      Left            =   360
      TabIndex        =   2
      Top             =   1800
      Width           =   1215
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "证件状态"
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   480
      Width           =   1215
   End
End
Attribute VB_Name = "frmCInfoM"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim conditionTree As String
Dim conditionCombo As String
Dim rs As ADODB.Recordset
Dim SQLStr As String


'窗体frmCInfoM加载事件
Private Sub Form_Load()
cboStatus.ListIndex = 0         '设置证件状态为全部
Call AddCTypeList(LstCType)    '为ListCType加载证件类型名称
conditionCombo = ""            '初始化condition
conditionTree = ""              '初始化conditionTree
Call adoCInfoRefresh            '调用adoCInfoRefresh过程加载证件信息

End Sub

'单击 cboStatus
Private Sub cboStatus_Click()
If cboStatus.ListIndex = 0 Then          '如果选择全部
   conditionCombo = ""
Else       '如果选择其他
   conditionCombo = "and i.CardState=" & Trim(Str(cboStatus.ListIndex - 1))
   
End If
Call adoCInfoRefresh           '调用adoCInfoRefresh过程



End Sub

'单击"添加"按钮,设置frmCInfoEdit窗体的初始值,将录入的数据插入到CardInfo表中
Private Sub cmdAdd_Click()
'给借阅证件信息编辑窗口赋值
frmCInfoEdit.txtCNo = ""
frmCInfoEdit.txtCNo.Locked = False
frmCInfoEdit.txtReader = ""
frmCInfoEdit.txtWorkPlace = ""
frmCInfoEdit.txtIDCard = ""
frmCInfoEdit.dtpCreateDate = Now
frmCInfoEdit.cboState.ListIndex = 0 '置为有效
IsAdd = True
frmCInfoEdit.Show 1                 '启动编辑窗体
adoCInfo.Refresh                    '刷新adoCInfo控件
Call adoCInfoRefresh

End Sub

'返回按钮
Private Sub cmdBack_Click()
Unload Me

End Sub

'添加"删除"按钮,在adoCInfo中选择一个记录项,从表CardInfo中删除该记录
Private Sub cmdDel_Click()
Dim isDel As Integer
If adoCInfo.Recordset.BOF Or adoCInfo.Recordset.EOF Then
   MsgBox "请选择一条记录", vbInformation, "信息提示"
Else
   isDel = MsgBox("是否删除所有选择的记录", vbYesNo + vbQuestion + vbDefaultButton2, "是否删除")
   If isDel = vbYes Then
      SQLStr = "delete from CardInfo where CardNo='" + Trim(adoCInfo.Recordset.Fields(0)) + "'"
      SQLExt SQLStr                '执行delete 语句
      MsgBox "删除成功!", vbInformation, "信息提示"
   End If
End If
adoCInfo.Refresh   '刷新
Call adoCInfoRefresh

   
End Sub

'单击"修改"按钮,设置frmCInfoEdit窗体的初始值,将录入的数据更新到CardInfo表中
Private Sub cmdModi_Click()
'如果没记录的话,不能进行修改
If adoCInfo.Recordset.BOF Or adoCInfo.Recordset.EOF Then
   MsgBox "请选择一条记录", vbInformation, "信息提示"
   Exit Sub
End If
'给借阅证件信息编辑窗口赋值
frmCInfoEdit.txtCNo = Trim(adoCInfo.Recordset.Fields(0))
frmCInfoEdit.txtCNo.Locked = True
frmCInfoEdit.txtReader = Trim(adoCInfo.Recordset.Fields(1))
frmCInfoEdit.txtWorkPlace = Trim(adoCInfo.Recordset.Fields(2))
frmCInfoEdit.txtIDCard = Trim(adoCInfo.Recordset.Fields(3))
frmCInfoEdit.dtpCreateDate = adoCInfo.Recordset.Fields(9)
Dim vCardState As Integer
Dim vCardNo As String
vCardNo = adoCInfo.Recordset.Fields(0)
SQLStr = "select *from CardInfo where cardno='" + vCardNo + "'"
Set rs = SQLQuery(SQLStr)
vCardState = rs.Fields("cardstate")
'根据办证时间判断此证件是否过期
If Now - adoCInfo.Recordset.Fields(9) > 365 Then
   'objCardInfo.updateState Trim(adoCInfo.Recordset.Fields(0)), 1
   vCardState = 1
   MsgBox "此证件已过期", vbInformation, "信息提示"
End If
If vCardState = 2 Then
   frmCInfoEdit.cmdLoss.Caption = "取消挂失"
End If
frmCInfoEdit.cboState.ListIndex = vCardState
IsAdd = False
frmCInfoEdit.Show 1                 '启动编辑窗体
adoCInfo.Refresh                    '刷新adoCInfo控件
Call adoCInfoRefresh


End Sub



'网格控件dtgCInfo加载函数
Private Sub adoCInfoRefresh()
'设置ADO控件adoCInfoRefresh的连接字符串
adoCInfo.ConnectionString = CONSTR
Dim tmpRecordSource As String         '设置数据源
tmpRecordSource = "select i.CardNo as 借阅证号,i.Reader as 读者姓名,i.WorkPlace as 工作单位,i.IDCard as 身份证号,i.CTypeID as 借阅证类型,t.TypeName as 类型名称,t.MaxCount as 借书数目,t.MaxDays as 借书时间,t.RenewDays as 续借时间,i.CreateDate as 办证时间 from CardInfo i,CardType t where i.CTypeID=t.CTypeID " + conditionCombo + " order by i.CardNo"
'tmpRecordSource = "select i.CardNo as 借阅证号,i.reader as 读者姓名,i.WorkPlace as 工作单位,i.IDCard as 身份证号,i.CTypeID as 借阅证类型,t.TypeName as 类型名称,t.MaxCount as 借书数目,t.MaxDays as 借书时间,t.RenewDays as 续借时间,i.CreateDate as 办证时间 from CardInfo i,CardType t where i.CTypeID=t.CTypeID" + conditionCombo + " order by i.CardNo"
'tmpRecordSource = "select i.CardNo as 借阅证号,i.Reader as 读者姓名,i.WorkPlace as 工作单位,i.IDCard as 身份证号,i.CTypeID as 借阅证类型,t.TypeName as 类型名称,t.MaxCount as 借书数目,t.MaxDays as 借书时间,t.RenewDays as 续借时间,i.CreateDate as 办证时间 from CardInfo i,CardType t where i.CTypeID=t.CTypeID" + conditionCombo + "ORDER BY i.CardNo"
'adoCInfo.RecordSource = tmpRecordSource
adoCInfo.RecordSource = tmpRecordSource
adoCInfo.Refresh                      '刷新ADODC 控件
With dtgCInfo                         '置dtgCInfo显示数据列的宽度
.Columns(0).Width = 800
.Columns(1).Width = 800
.Columns(2).Width = 1200
.Columns(3).Width = 800
.Columns(4).Width = 1000
.Columns(5).Width = 800
.Columns(6).Width = 800
.Columns(7).Width = 800
.Columns(8).Width = 800
.Columns(9).Width = 1200
End With

End Sub
'单击LstCType
Private Sub LstCType_Click()
'Dim cnn As New ADODB.Connection
'Dim rs As New ADODB.Recordset
'如果是全部类型
If LstCType.ListIndex = 0 Then
   conditionTree = ""
Else
   '设置SQL语句
   SQLStr = "select * from CardType where TypeName='"
   SQLStr = SQLStr + Trim(LstCType.List(LstCType.ListIndex)) + "'"
   
   
   'Set cnn = New ADODB.Connection     '关键字New用于创建新对象cnn
   'cnn.ConnectionString = CONSTR      '设置连接字符串的ConnectionString属性
   'cnn.Open
   
   'rs.Open SQLStr, cnn, adOpenDynamic, adLockOptimistic
   
   Set rs = SQLQuery(SQLStr)
   conditionTree = "and t.CTypeID='" & rs.Fields(0) + "'"
End If
'调用adoCInfoRefresh 过程
'Call adoCInfoRefresh
  
  
  adoCInfo.ConnectionString = CONSTR
Dim tmpRecordSource As String         '设置数据源
tmpRecordSource = "select i.CardNo as 借阅证号,i.reader as 读者姓名,i.WorkPlace as 工作单位,i.IDCard as 身份证号,i.CTypeID as 借阅证类型,t.TypeName as 类型名称,t.MaxCount as 借书数目,t.MaxDays as 借书时间,t.RenewDays as 续借时间,i.CreateDate as 办证时间 from CardInfo i,CardType t where i.CTypeID=t.CTypeID " + conditionTree + " order by i.CardNo"
adoCInfo.RecordSource = tmpRecordSource
adoCInfo.Refresh                      '刷新ADODC 控件
With dtgCInfo                         '置dtgCInfo显示数据列的宽度
.Columns(0).Width = 800
.Columns(1).Width = 800
.Columns(2).Width = 1200
.Columns(3).Width = 800
.Columns(4).Width = 1000
.Columns(5).Width = 800
.Columns(6).Width = 800
.Columns(7).Width = 800
.Columns(8).Width = 800
.Columns(9).Width = 1200
End With

 
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -