SQL+VB图书管理系统(数据库+源代码+论文) 第4页

SQL+VB图书管理系统(数据库+源代码+论文) 第4页
注:其中图书逾期罚款查询、图书丢失罚款查询界面设计和图书借阅信息查询界面设计相同,故在此略。
2.借书还书续借界面设计
 
其中,“借书新增”和“续借新增”界面相同,界面设计如下:
 
注: “归还新增”界面与其相似,故在此略。
3.3.5 读者管理界面设计
   “读者类别查询”界面设计如下:
   
注:其中,“图书类型查询”界面与此界面公用,故在此略。
3.3.6 用户信息界面设计
  
3.4 代码设计
3.4.1 标准模块代码设计
   Public strcnn As String
Public strfind As String
Public adocnn As New ADODB.Connection
Public adorst As New ADODB.Recordset
Type Login
  yhqx As String
  yhm As String
  End Type
Public yh_login As Login
Public Sub ShowData(sql As String, ctr As Control)
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Dim i As Integer, j As Integer, k As Integer
cnn.Open strcnn
rst.Open sql, cnn, adOpenStatic, adLockReadOnly
With ctr
.Rows = rst.RecordCount + 1
.Cols = rst.Fields.Count
For i = 0 To .Cols - 1
 .TextMatrix(0, i) = rst.Fields(i).Name
Next i
For j = 1 To .Rows - 1
  For k = 0 To .Cols - 1
    .TextMatrix(j, k) = rst.Fields(k).Value & ""
  Next k
  rst.MoveNext
Next j
rst.Close
cnn.Close
End With
End Sub
Public Function Update(sql As String) As Long
Dim cnn As New ADODB.Connection
Dim cmd As New ADODB.Command
On Error GoTo lab
cnn.Open strcnn
cnn.BeginTrans
cmd.ActiveConnection = cnn
cmd.CommandType = adCmdText
cmd.CommandText = sql
cmd.Execute
cnn.CommitTrans
cnn.Close
Update = Err
Exit Function
lab:
If cnn.State = 1 Then
  cnn.RollbackTrans
  cnn.Close
End If
MsgBox Err.Description
Update = Err
End Function
Public Sub PanDuan()
  Dim sql As String, sql1 As String, strSql1 As String
  Dim strSql2 As String, strSql3 As String, strSql4 As String
  
   If Frm_jhx.Txt_txm.Text <> "" And Frm_jhx.Txt_tsid.Text <> "" And Frm_jhx.Txt_tsmc.Text <> "" _
       And Frm_jhx.Txt_dzlb.Text <> "" And Frm_jhx.Txt_dzxm.Text <> "" And Frm_jhx.Txt_jszh.Text <> "" Then
     
      If Frm_jhx.Cmd_jhxs.Caption = "借出此书" Then
     
          If MsgBox("是否借出此书?", vbOKCancel + vbQuestion, "询问") = vbOK Then
            sql = "select * from 图书借阅 where 借书证号='" + Trim(Frm_jhx.Txt_jszh.Text) + "'"
            ShowData sql, Frm_jhx.MSFlexGrid1
            Frm_jhx.StatusBar1.Panels(1).Text = "总共有" & Frm_jhx.MSFlexGrid1.Rows - 1 & "条记录"
           
            strSql1 = "select 状态 from 图书信息 where 图书ID='" + Trim(Frm_jhx.Txt_tsid.Text) + "'"
            ShowData strSql1, Frm_data2.MSFlexGrid2
           
            If Trim(Frm_data2.MSFlexGrid2.TextMatrix(Frm_data2.MSFlexGrid2.Row, 0)) = "借出" Then
              MsgBox "此书籍库存量为0不可借!", vbOKOnly + vbInformation, "信息"
              Exit Sub
            End If
           
            Frm_data2.MSFlexGrid2.Clear
            Frm_data2.MSFlexGrid2.Cols = 2
            Frm_data2.MSFlexGrid2.Rows = 2
           
            strSql2 = "select * from 图书罚款 where 图书ID='" + Trim(Frm_jhx.Txt_tsid.Text) + "'"
            ShowData strSql2, Frm_data2.MSFlexGrid2

上一页  [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]  ... 下一页  >> 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有