当前位置:文档之家› 图书管理系统程序源代码

图书管理系统程序源代码

图书管理系统程序源代码
图书管理系统程序源代码

源程序

1.主窗体

Private Sub add_back_Click() frmbackbookinfo.Show

End Sub

Private Sub add_binf_Click() frmaddbookinfo.Show

End Sub

Private Sub add_book_style_Click() frmaddbookstyle.Show

End Sub

Private Sub add_manager_Click() frmadduser.Show

End Sub

Private Sub add_rinf_Click() frmaddreaderinfo.Show

End Sub

Private Sub add_rstyle_Click() frmaddreaderstyle.Show

End Sub

Private Sub change_binf_Click() frmmodifybookinfo.Show

End Sub

Private Sub change_book_style_Click() frmmodifybookstyle.Show

End Sub

Private Sub delete_binf_Click() frmmodifybookinfo.Show

End Sub

Private Sub delete_book_style_Click() frmmodifybookstyle.Show

End Sub

Private Sub delete_rstyle_Click() frmmodifyreaderstyle.Show

End Sub

Private Sub exit_Click()

End

End Sub

Private Sub find_binf_Click() frmfindbook.Show

End Sub

Private Sub find_lend_Click() frmfindborrowinfo.Show

End Sub

Private Sub find_rinf_Click()

frmfindreader.Show

End Sub

Private Sub password_Click()

frmchangepwd.Show

End Sub

2.Login

Option Explicit

Private Sub cmdOK_Click()

Dim strUserName As String

Dim strPassword As String

Dim strTargetAsp As String

Dim conn As ADODB.Connection

Dim rsLogin As ADODB.Recordset

Dim strSQL As String

If Trim(txtUserName.Text) = "" Then

MsgBox "“用户名”不能为空!"

Exit Sub

Else

strUserName = Trim(txtUserName.Text)

End If

If Trim(txtPassword.Text) = "" Then

MsgBox "“口令”不能为空!"

Exit Sub

Else

strPassword = Trim(txtPassword.Text)

End If

'检查口令、用户身份

Set conn = New ADODB.Connection

conn.Provider = "Microsoft.jet.OLEDB.4.0"

conn.ConnectionString = "D:\图书管理系统\book.mdb"

conn.Open

strUserName = Replace(strUserName, "'", "“")

strSQL = "select*from 系统管理where 用户名='" & strUserName & "'and 密码='" & strPassword & "'"

Set rsLogin = conn.Execute(strSQL)

If rsLogin.EOF Or rsLogin.BOF Then

MsgBox "用户名或口令错误,请检查!"

txtPassword.SelStart = 0

txtPassword.SelLength = Len(txtPassword.Text)

txtPassword.SetFocus

Else

Select Case rsLogin("权限")

Case "领导"

strTargetAsp = "LeadersMain.asp"

Case "主任"

strTargetAsp = "ZhuRenMain.asp"

Case "秘书"

strTargetAsp = "MishuMain.asp"

Case "图书管理员"

strTargetAsp = "TuShuManagerMain.asp"

Case Else

strTargetAsp = "OtherMain.asp"

End Select

SaveSetting "JGYOA", "Login", "UserName", strUserName

Hyperlink.NavigateTo "HTTP://" & "/oa/" & strTargetAsp

End If

'释放变量

Set rsLogin = Nothing

Set conn = Nothing

End Sub

3.frmaddbookinfo

Private Sub Command1_Click()

Dim rs_addbook As New ADODB.Recordset

Dim sql As String

If Trim(Combo1.Text) = " " Then

MsgBox "请选择图书种类", vbOKOnly + vbExclamation, ""

Combo1.SetFocus

Exit Sub

End If

If Trim(Text1.Text) = " " Then

MsgBox "图书编号不能为空", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Exit Sub

End If

If Trim(Text2.Text) = " " Then

MsgBox "书名不能为空", vbOKOnly + vbExclamation, ""

Text2.SetFocus

Exit Sub

End If

If Not IsDate(Text5.Text) Then

MsgBox "请按照yyy-mm-dd格式输入日期", vbOKOnly + vbExclamation, ""

Text5.SetFocus

Exit Sub

End If

If Not IsDate(Text6.Text) Then

MsgBox "请按照yyy-mm-dd格式输入日期", vbOKOnly + vbExclamation, ""

Text6.SetFocus

Exit Sub

End If

sql = "select * from 书籍信息where 书籍编号='" & Text1.Text & "'" rs_addbook.Open sql, conn, adOpenKeyset, adLockPessimistic

If rs_addbook.EOF Then

rs_addbook.AddNew

rs_addbook.Fields(0) = Trim(Text1.Text)

rs_addbook.Fields(1) = Trim(Text2.Text)

rs_addbook.Fields(2) = Trim(Combo1.Text)

rs_addbook.Fields(3) = Trim(Text3.Text)

rs_addbook.Fields(4) = Trim(Text4.Text)

rs_addbook.Fields(5) = Trim(Text5.Text)

rs_addbook.Fields(6) = Trim(Text6.Text)

rs_addbook.Fields(7) = "否"

rs_addbook.Update

MsgBox "添加图书信息成功!", vbOKOnly, ""

rs_addbook.Close

Else

MsgBox "图书编号重复!", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Text1.Text = ""

rs_addbook.Close

Exit Sub

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Load()

Dim rs_leibie As New ADODB.Recordset

Dim sql As String

sql = "select * from 图书类别"

rs_leibie.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_leibie.MoveFirst

Do While Not rs_leibie.EOF

Combo1.AddItem rs_leibie.Fields(0)

rs_leibie.MoveNext

Loop

rs_leibie.Close

End Sub

4.frmaddbookstyle

Private Sub Command1_Click()

Dim rs_bookstyle As New ADODB.Recordset

Dim sql As String

If Trim(Text1.Text) = "" Then

MsgBox "图书种类不能为空", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Exit Sub

End If

If Trim(Text2.Text) = "" Then

MsgBox "种类编号不能为空", vbOKOnly + vbExclamation, ""

Text2.SetFocus

Exit Sub

End If

sql = " select * from 图书类别where 类别名称='" & Text1.Text & "'" rs_bookstyle.Open sql, conn, adOpenKeyset, adLockOptimistic

If rs_bookstyle.EOF Then

rs_bookstyle.AddNew

rs_bookstyle.Fields(0) = Trim(Text1.Text)

rs_bookstyle.Fields(1) = Trim(Text2.Text)

rs_bookstyle.Update

MsgBox "添加图书类别成功!", vbOKOnly, ""

rs_bookstyle.Close

Else

MsgBox "读者类别重复!", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Text1.Text = " "

rs_bookstyle.Close

Exit Sub

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

5.frmaddreaderinfo

Option Explicit

Dim rs_addreader As New ADODB.Recordset

Private Sub Command1_Click()

Dim sql As String

If Trim(Combo1.Text) = "" Then

MsgBox "请选择读者种类", vbOKOnly + vbExclamation, ""

Combo1.SetFocus

Exit Sub

End If

If Trim(Text2.Text) = "" Then

MsgBox "读者姓名不能为空", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Exit Sub

End If

If Trim(Text3.Text) = "" Then

MsgBox "读者编号不能为空", vbOKOnly + vbExclamation, ""

Text2.SetFocus

Exit Sub

End If

sql = "select * from 读者信息where 读者编号='" & Text2.Text & "'" rs_addreader.Open sql, conn, adOpenKeyset, adLockPessimistic

If rs_addreader.EOF Then

rs_addreader.AddNew

rs_addreader.Fields(0) = Trim(Text2.Text)

rs_addreader.Fields(1) = Trim(Text3.Text)

rs_addreader.Fields(2) = Trim(Combo2.Text)

rs_addreader.Fields(3) = Trim(Combo1.Text)

rs_addreader.Fields(4) = Trim(Text5.Text)

rs_addreader.Fields(5) = Trim(Text6.Text)

rs_addreader.Fields(6) = Trim(Text4.Text)

rs_addreader.Fields(7) = CDate(Text1.Text)

rs_addreader.Update

MsgBox "添加读者信息成功!", vbOKOnly, ""

rs_addreader.Close

Else

MsgBox "读者编号重复!", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Text1.Text = ""

rs_addreader.Close

Exit Sub

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Load()

Combo2.AddItem "男"

Combo2.AddItem "女"

Dim rs_leibie As New ADODB.Recordset

Dim sql As String

sql = "select * from 读者类别"

rs_leibie.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_leibie.MoveFirst

Do While Not rs_leibie.EOF

Combo1.AddItem rs_leibie.Fields(0)

rs_leibie.MoveNext

Loop

rs_leibie.Close

End Sub

6.frmaddreaderstyle

Option Explicit

Dim rs_readerstyle As New ADODB.Recordset

Private Sub Command1_Click()

Dim sql As String

If Trim(Text1.Text) = "" Then

MsgBox "读者种类不能为空!", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Exit Sub

End If

If Trim(Text2.Text) = "" Then

MsgBox "借书数量不能为空!", vbOKOnly + vbExclamation, ""

Text2.SetFocus

Exit Sub

End If

If Trim(Text3.Text) = "" Then

MsgBox "借书期限不能为空!", vbOKOnly + vbExclamation, ""

Text3.SetFocus

Exit Sub

End If

If Trim(Text4.Text) = "" Then

MsgBox "有限期限不能为空!", vbOKOnly + vbExclamation, ""

Text4.SetFocus

Exit Sub

End If

sql = "select*from 读者类别where 种类名称='" & Text1.Text & "'" rs_readerstyle.Open sql, conn, adOpenKeyset, adLockPessimistic

If rs_readerstyle.EOF Then

rs_readerstyle.AddNew

rs_readerstyle.Fields(0) = Trim(Text1.Text)

rs_readerstyle.Fields(1) = Trim(Text2.Text)

rs_readerstyle.Fields(2) = Trim(Text3.Text)

rs_readerstyle.Fields(3) = Trim(Text4.Text)

rs_readerstyle.Update

MsgBox "添加读者类别成功!", vbOKOnly, ""

rs_readerstyle.Close

Else

MsgBox "读者类别重复!", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Text1.Text = ""

rs_readerstyle.Close

Exit Sub

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

7.frmadduser

Private Sub Command1_Click()

Dim sql As String

Dim rs_add As New ADODB.Recordset

If Trim(Text1.Text) = "" Then

MsgBox "用户名不能为空", vbOKOnly + vbExclamation, ""

Exit Sub

Text1.SetFocus

Else

sql = "select * from 系统管理"

rs_add.Open sql, conn, adOpenKeyset, adLockPessimistic

While (rs_add.EOF = False)

If Trim(rs_add.Fields(0)) = Trim(Text1.Text) Then

MsgBox "已有这个用户", vbOKOnly + vbExclamation, ""

Text1.SetFocus

Text1.Text = ""

Text2.Text = ""

Text3.Text = ""

Combo1.Text = ""

Exit Sub

Else

rs_add.MoveNext

End If

Wend

If Trim(Text2.Text) <> Trim(Text3.Text) Then

MsgBox "两次密码不一致", vbOKOnly + vbExclamation, ""

Text2.SetFocus

Text2.Text = ""

Text3.Text = ""

Exit Sub

Else

If Trim(Combo1.Text) <> "system" And Trim(Combo1.Text) <> "guest" Then MsgBox "请选择正确的用户权限", vbOKOnly + vbExclamation, ""

Combo1.SetFocus

Combo1.Text = ""

Exit Sub

Else

rs_add.AddNew

rs_add.Fields(0) = Text1.Text

rs_add.Fields(1) = Text2.Text

rs_add.Update

rs_add.Close

MsgBox "添加用户成功", vbOKOnly + vbExclamation, ""

Unload Me

End If

End If

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Load()

Combo1.AddItem "system"

Combo1.AddItem "guest"

End Sub

8.frmbackbookinfo

Private Sub Combo1_Click()

Combo2.ListIndex = Combo1.ListIndex

End Sub

Private Sub Combo2_Click()

Combo1.ListIndex = Combo2.ListIndex

End Sub

Private Sub Combo3_Click()

Combo4.ListIndex = Combo3.ListIndex

End Sub

Private Sub Combo4_Click()

Combo3.ListIndex = Combo4.ListIndex

End Sub

Private Sub Command1_Click()

Dim book_num As String

Dim reader_num As String

Dim answer As String

Dim rs_back As New ADODB.Recordset

Dim sql As String

On Error GoTo delerror

book_num = DataGrid1.Columns(3).CellV alue(DataGrid1.Bookmark) reader_num = DataGrid1.Columns(1).CellV alue(DataGrid1.Bookmark) answer = MsgBox("确定要还这本书吗?", vbY esNo, "")

If answer = vbY es Then

sql = "select * from 借阅信息where 书籍编号='" & book_num & "'"

rs_back.CursorLocation = adUseClient

rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_back.Delete

rs_back.Update

rs_back.Close

sql = "select * from 书籍信息where 书籍编号='" & book_num & "'"

rs_back.CursorLocation = adUseClient

rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_back.Fields(7) = "否"

rs_back.Update

rs_back.Close

sql = "select * from 读者信息where 读者编号='" & reader_num & "'"

rs_back.CursorLocation = adUseClient

rs_back.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_back.Fields(8) = rs_back.Fields(8) - 1

rs_back.Update

rs_back.Close

If findform = True Then

Command1_Click

Else

Command2_Click

End If

MsgBox "成功删除!", vbOKOnly + vbExclamation, ""

DataGrid1.AllowDelete = False

Else

Exit Sub

End If

delerror:

If Err.Number <> 0 Then

MsgBox Err.Description

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Command3_Click()

Dim rs_reader As New ADODB.Recordset

Dim sql As String

findform = Ture

sql = "select*from 借阅信息where 读者姓名='" & Combo2.Text & "'" rs_reader.CursorLocation = adUseClient

rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic

Set DataGrid1.DataSource = rs_reader

DataGrid1.AllowAddNew = False

DataGrid1.AllowDelete = False

DataGrid1.AllowUpdate = False

End Sub

Private Sub Command4_Click()

Dim rs_book As New ADODB.Recordset

Dim sql As String

findform = False

sql = "select * from 借阅信息where 书籍编号='" & Combo3.Text & "'" rs_book.CursorLocation = adUseClient

rs_book.Open sql, conn, adOpenKeyset, adLockPessimistic

Set DataGrid1.DataSource = rs_book

DataGrid1.AllowAddNew = False

DataGrid1.AllowDelete = False

DataGrid1.AllowUpdate = False

End Sub

Private Sub Form_Load()

Dim rs_reader As New ADODB.Recordset

Dim rs_book As New ADODB.Recordset

Dim sql As String

sql = "select * from 读者信息"

rs_reader.CursorLocation = adUseClient

rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic

If Not rs_reader.EOF Then

Do While Not rs_reader.EOF

Combo1.AddItem rs_reader.Fields(1)

Combo2.AddItem rs_reader.Fields(0)

rs_reader.MoveNext

Loop

End If

rs_reader.Close

sql = "select * from 借阅信息"

rs_book.CursorLocation = adUseClient

rs_book.Open sql, conn, adOpenKeyset, adLockPessimistic

If Not rs_book.EOF Then

Do While Not rs_book.EOF

Combo3.AddItem rs_book.Fields(3)

Combo4.AddItem rs_book.Fields(4)

rs_book.MoveNext

Loop

End If

rs_book.Close

End Sub

9.frmborrowbook

Option Explicit

Dim leibie As String

Dim qixian As Integer

Dim shumu As Integer

Dim maxnum As Integer

Private Sub Combo1_Change()

Combo2.ListIndex = Combo1.ListIndex

End Sub

Private Sub Combo2_Change()

Combo1.ListIndex = Combo2.ListIndex

End Sub

Private Sub Command1_Click()

Dim rs_borrowbook As New ADODB.Recordset

Dim sql As String

sql = "select * from读者信息where读者编号='" & Combo1.Text & "" rs_borrowbook.Open sql, conn.adOpenKeyset, adLockPessimistic

leibie = rs_borrowbook.Fields(3)

shumu = rs_borrowbook.Fields(8)

rs_borrowbook.Close

sql = "select * from读者类别where种类名称='" & leibie & ""

rs_borrowbook.Open sql, conn.adOpenKeyset, adLockPessimistic qixian = rs_borrowbook.Fields(2)

maxnum = rs_borrowbook.Fields(1)

rs_borrowbook.Close

If shumu >= maxnum Then

MsgBox "该读者借书数额已满!", vbOKOnly + vbExclamation Exit Sub

End If

sql = "select * from借阅信息"

rs_borrowbook.Open sql, conn.adOpenKeyset, adLockPessimistic

rs_borrowbook.AddNew

rs_borrowbook.Fields(1) = Combo1.Text

rs_borrowbook.Fields(2) = Combo2.Text

rs_borrowbook.Fields(3) = Label8.Caption

rs_borrowbook.Fields(4) = Label9.Caption

rs_borrowbook.Fields(5) = Date

rs_borrowbook.Fields(6) = DateAdd("Ww", qixian, Date)

rs_borrowbook.Update

rs_borrowbook.Close

sql = "select * from书籍信息where书籍编号='" & book_num & ""

rs_borrowbook.Open sql, conn.adOpenKeyset, adLockPessimistic

rs_borrowbook.Fields(7) = "是"

rs_borrowbook.Update

rs_borrowbook.Close

sql = "select * from读者信息where读者编号='" & Combo1.Text & "" rs_borrowbook.Open sql, conn.adOpenKeyset, adLockPessimistic

rs_borrowbook.Fields(8) = rs_borrowbook.Fields(8) + 1

rs_borrowbook.Update

rs_borrowbook.Close

MsgBox "本书借阅成功!", vbOKOnly + vbExclamation

Unload Me

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Load()

Dim rs_borrow As New ADODB.Recordset

Dim rs_reader As New ADODB.Recordset

Dim sql As String

sql = "select * from 书籍信息where 书籍编号= '" & book_num & "'" rs_borrow.Open sql, conn, adOpenKeyset, adLockPessimistic

Label8.Caption = rs_borrow.Fields(0)

Label9.Caption = rs_borrow.Fields(1)

Label10.Caption = rs_borrow.Fields(2)

Label11.Caption = rs_borrow.Fields(3)

Label12.Caption = rs_borrow.Fields(4)

Label13.Caption = rs_borrow.Fields(5)

Label14.Caption = rs_borrow.Fields(6)

sql = "select * from 读者信息"

rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic

If Not rs_reader.EOF Then

Do While Not rs_reader.EOF

Combo1.AddItem rs_reader.Fields(1)

Combo2.AddItem rs_reader.Fields(0)

rs_reader.MoveNext

Loop

Else

MsgBox "请先登记读者", vbOKOnly + vbExclamation

Exit Sub

End If

rs_borrow.Close

rs_reader.Close

End Sub

10.frmchangepwd

Private Sub Command1_Click()

Dim rs_chang As New ADODB.Recordset

Dim sql As String

If Trim(Text1.Text) <> Trim(Text2.Text) Then

MsgBox "密码不一致", vbOKOnly + vbExclamation, ""

Text2.SetFocus

Text1.Text = ""

Text2.Text = ""

Else

sql = "select*from 系统管理where 用户名='" & userID & "'"

rs_chang.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_chang.Fields(1) = Text1.Text

rs_chang.Update

rs_chang.Close

MsgBox "密码修改成功", vbOKOnly + vbExclamation, ""

Unload Me

End If

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

11.frmfindbook

Option Explicit

Dim panduan As String

Private Sub Command1_Click()

Dim rs_findbook As New ADODB.Recordset

Dim sql As String

If Check1.V alue = vbChecked Then

sql = "书名='" & Trim(Text1.Text & "") & "'"

End If

If Check2.V alue = vbChecked Then

If Trim(sql) = "" Then

sql = "类别='" & Trim(Combo1.Text & "") & "'"

Else

sql = sql & "and 书名='" & Trim(Combo1.Text & "") & "'"

End If

End If

If Check3.V alue = vbChecked Then

If Trim(sql) = "" Then

sql = "作者='" & Trim(Text2.Text & "") & "'"

Else

sql = sql & "and 作者='" & Trim(Text2.Text & "") & "'"

End If

End If

If Check4.V alue = vbChecked Then

If Trim(sql) = "" Then

sql = "出版社='" & Trim(Text3.Text & "") & "'"

Else

sql = sql & "and 出版社='" & Trim(Text3.Text & "") & "'"

End If

End If

If Check5.V alue = vbChecked Then

If Trim(sql) = "" Then

sql = "书籍编号='" & Trim(Text4.Text & "") & "'"

Else

sql = sql & "and 书籍编号='" & Trim(Text4.Text & "") & "'"

End If

End If

If Trim(sql) = "" Then

MsgBox "请选择查询方式!", vbOKOnly + vbExclamation

Exit Sub

End If

sql = "select * from 书籍信息where " & sql

rs_findbook.CursorLocation = adUseClient

rs_findbook.Open sql, conn, adOpenKeyset, adLockPessimistic

DataGrid1.AllowAddNew = False

DataGrid1.AllowDelete = False

DataGrid1.AllowUpdate = False

Set DataGrid1.DataSource = rs_findbook

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Command3_Click()

If Trim(book_num) = "" Then

MsgBox "请选择要借阅的图书!", vbOKOnly + vbExclamation

Exit Sub

End If

If panduan = "是" Then

MsgBox "此书已被借出!", vbOKOnly + vbExclamation

Exit Sub

End If

frmborrowbook.Show

End Sub

Private Sub DataGrid1_RowColChange(LastRow As V ariant, ByV al LastCol As Integer) book_num = DataGrid1.Columns(0).CellV alue(DataGrid1.Bookmark)

panduan = DataGrid1.Columns(7).CellV alue(DataGrid1.Bookmark)

End Sub

Private Sub Form_Load()

Dim rs_find As New ADODB.Recordset

Dim sql As String

sql = "select * from 图书类别"

rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic

rs_find.MoveFirst

If Not rs_find.EOF Then

Do While Not rs_find.EOF

Combo1.AddItem rs_find.Fields(0)

rs_find.MoveNext

Loop

Combo1.ListIndex = 0

End If

rs_find.Close

End Sub

12.frmfindborrowinfo

Private Sub Command1_Click()

Dim sql As String

Dim rs_find As New ADODB.Recordset

If Option1.V alue = True Then

sql = "select * from 书籍信息where 是否被借出='是'"

End If

If Option2.V alue = True Then

sql = "select * from 书籍信息where 是否被借出='否'"

End If

If Option3.V alue = True Then

sql = "select * from 书籍信息where 读者姓名='" & Text1.Text & "'" End If

rs_find.CursorLocation = adUseClient

rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic

DataGrid1.AllowAddNew = False

DataGrid1.AllowDelete = False

DataGrid1.AllowUpdate = False

Set DataGrid1.DataSource = rs_find

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

13.frmfindreader

Option Explicit

Private Sub Command1_Click()

Dim rs_findreader As New ADODB.Recordset

Dim sql As String

If Check1.V alue = vbChecked Then

sql = "读者编号='" & Trim(Text1.Text & "") & "'"

End If

If Check2.V alue = vbChecked Then

If Trim(sql) = "" Then

sql = "读者姓名='" & Trim(Text2.Text & "") & "'"

Else

sql = sql & "and读者姓名='" & Trim(Text2.Text & "") & "'" End If

End If

If Check3.V alue = vbChecked Then

If Trim(sql) = "" Then

sql = "读者类别='" & Trim(Combo1.Text & "") & "'"

Else

sql = sql & "and读者类别='" & Trim(Combo1.Text & "") & "'" End If

End If

sql = "select * from 读者信息where " & sql

rs_findreader.CursorLocation = adUseClient

rs_findreader.Open sql, conn, adOpenKeyset, adLockPessimistic DataGrid1.AllowAddNew = False

DataGrid1.AllowDelete = False

DataGrid1.AllowUpdate = False

Set DataGrid1.DataSource = rs_findreader

'rs_findreader.Close

End Sub

Private Sub Command2_Click()

Unload Me

End Sub

Private Sub Form_Load()

Dim rs_find As New ADODB.Recordset

Dim sql As String

sql = "select * from 读者类别"

rs_find.Open sql, conn, adOpenKeyset, adLockPessimistic

If Not rs_find.EOF Then

Do While Not rs_find.EOF

Combo1.AddItem rs_find.Fields(0)

rs_find.MoveNext

Loop

Combo1.ListIndex = 0

End If

rs_find.Close

End Sub

14.frmmodifybookinfo

Option Explicit

Dim rs_book As New ADODB.Recordset

Private Sub cmdcancel_Click()

rs_book.CancelUpdate

DataGrid1.AllowAddNew = False

DataGrid1.AllowUpdate = False

cmdmodify.Enabled = True

cmddel.Enabled = False

cmdcancel.Enabled = False

cmdupdate.Enabled = False

End Sub

Private Sub cmddel_Click()

Dim answer As String

On Error GoTo delerror

answer = MsgBox("确定要删除吗?", vbY esNo, "")

If answer = vbY es Then

DataGrid1.AllowDelete = True

rs_book.Delete

rs_book.Update

DataGrid1.Refresh

MsgBox "成功删除!", vbOKOnly + vbExclamation, "" DataGrid1.AllowDelete = False

Else

Exit Sub

End If

delerror:

If Err.Number <> 0 Then

MsgBox Err.Description

End If

End Sub

Private Sub cmdmodify_Click()

Dim answer As String

On Error GoTo cmdmodify

cmddel.Enabled = False

cmdmodify.Enabled = False

cmdupdate.Enabled = True

cmdcancel.Enabled = True

DataGrid1.AllowUpdate = True

cmdmodify:

If Err.Number <> 0 Then

MsgBox Err.Description

End If

End Sub

Private Sub cmdupdate_Click()

If Not IsNull(DataGrid1.Bookmark) Then

rs_book.Update

End If

cmdmodify.Enabled = True

cmddel.Enabled = True

cmdcancel.Enabled = False

cmdupdate.Enabled = False

DataGrid1.AllowUpdate = False

MsgBox "修改成功!", vbOKOnly + vbExclamation, "" End Sub

Private Sub Form_Load()

Dim sql As String

On Error GoTo loaderror

sql = "select * from 书籍信息"

rs_book.CursorLocation = adUseClient

rs_book.Open sql, conn, adOpenKeyset, adLockPessimistic cmdupdate.Enabled = False

DataGrid1.AllowAddNew = False

DataGrid1.AllowDelete = False

DataGrid1.AllowUpdate = False

If userpow = "guest" Then

Frame2.Enabled = False

End If

Set DataGrid1.DataSource = rs_book

Exit Sub

loaderror:

MsgBox Err.Description

End Sub

Private Sub Form_Unload(Cancel As Integer)

Set DataGrid1.DataSource = Nothing

rs_book.Close

End Sub

15.frmmodifybookstyle

Option Explicit

Dim rs_reader As New ADODB.Recordset

Private Sub cmdcancel_Click()

rs_reader.CancelUpdate

DataGrid1.AllowAddNew = False

DataGrid1.AllowUpdate = False

cmdmodify.Enabled = True

cmddel.Enabled = True

cmdcancel.Enabled = False

cmdupdate.Enabled = False

End Sub

Private Sub cmddel_Click()

Dim answer As String

On Error GoTo delerror

answer = MsgBox("确定要删除吗?", vbY esNo, "")

If answer = vbY es Then

DataGrid1.AllowDelete = True

rs_reader.Delete

rs_reader.Update

DataGrid1.Refresh

MsgBox "成功删除!", vbOKOnly + vbExclamation, ""

DataGrid1.AllowDelete = False

Else

Exit Sub

End If

delerror:

If Err.Number <> 0 Then

MsgBox Err.Description

End If

End Sub

Private Sub cmdmodify_Click()

Dim answer As String

On Error GoTo cmdmodify

cmddel.Enabled = False

cmdmodify.Enabled = False

cmdupdate.Enabled = True

cmdcancel.Enabled = True

DataGrid1.AllowUpdate = True

cmdmodify:

If Err.Number <> 0 Then

MsgBox Err.Description

End If

End Sub

Private Sub cmdupdate_Click()

If Not IsNull(DataGrid1.Bookmark) Then

rs_reader.Update

End If

cmdmodify.Enabled = True

cmddel.Enabled = True

cmdcancel.Enabled = False

cmdupdate.Enabled = False

DataGrid1.AllowUpdate = False

MsgBox "修改成功!", vbOKOnly + vbExclamation, ""

End Sub

Private Sub Form_Load()

Dim sql As String

On Error GoTo loaderror

sql = "select * from 图书类别"

rs_reader.CursorLocation = adUseClient

rs_reader.Open sql, conn, adOpenKeyset, adLockPessimistic

cmdupdate.Enabled = False '窗体刚刚加载时,"取消"按钮应设置为不可用,即将其Enabled属性设为False

附录(图书管理系统程序代码)

附录 主页面(MDImain): Private Sub addbook_Click() add_book.Show End Sub Private Sub addreader_Click() add_reader.Show End Sub Private Sub adduser_Click() add_user.Show End Sub Private Sub backbook_Click() back_book.Show End Sub Private Sub borrowbook_Click() borrow_book.Show End Sub Private Sub cuibackbook_Click() cuiback_book.Show End Sub Private Sub findbook_Click() find_book.Show End Sub Private Sub findreader_Click() find_reader.Show End Sub Private Sub MDIForm_Load() End Sub Private Sub modifybook_Click() change_book.Show End Sub Private Sub modifypwd_Click()

change_pwd.Show End Sub Private Sub modifyreader_Click() change_reader.Show End Sub Private Sub delbook_Click() del_book.Show End Sub Private Sub delreder_Click() del_reader.Show End Sub Private Sub quitsys_Click() End End Sub 登陆(login): Option Explicit Dim cnt As Integer '记录确定次数 Private Sub Command1_Click() Dim sql As String Dim rs_login As New ADODB.Recordset If Trim(txtuser.Text) = "" Then '判断输入的用户名是否为空MsgBox "没有这个用户", vbOKOnly + vbExclamation, "" txtuser.SetFocus Else sql = "select * from 用户表where 用户名='" & txtuser.Text & "'" rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic If rs_login.EOF = True Then MsgBox "没有这个用户", vbOKOnly + vbExclamation, "" txtuser.SetFocus Else '检验密码是否正确 If Trim(rs_login.Fields(1)) = Trim(txtpwd.Text) Then userID = txtuser.Text userpow = rs_login.Fields(2) rs_login.Close Unload Me MsgBox "欢迎登录到图书管理系统!", vbOKOnly + vbExclamation, "" MDImain.Show Else

C++图书管理系统源代码

图书管理系统 系统功能: 1.借书:根据借书人提出的图书编号(id)查询该图书,如果该图书现存量(store)不为0,则提示输入借阅者的学号(num),为借书人办理借书手续,提示用户该书已被 借出。 2.归书:根据借书人的学号查询该读者的信息,若有该读者,则提示输入所借书籍的编号(id),为该读者办理还书手续,提示该书已还。 3.书籍管理:弹出书籍管理界面,输入所要执行操作的号码: (1)增加书籍:弹出注册新书的窗口,按照提示输入所增加书籍的信息,最后,提示用户该书已被注册。 (2)删除书籍:弹出删除书籍的窗口,输入所要删除书籍的编号(id),输出该书的信息,确认是否删除该书,1为删除,0为放弃。 (3)修改书籍:弹出修改书籍的窗口,输入所要修改书籍的编号(id),输出该书的信息,确认是否修改该书,1为修改,0为放弃。之后按照提示重新输入书籍的信息。 4.读者管理:弹出读者管理界面,输入所要执行操作的号码: (1)增加读者:弹出注册读者的窗口,按照提示输入所增加读者的信息,最后,提示用户该读者已被注册。 (2)删除书籍:弹出删除读者的窗口,输入所要删除读者的学号(num),输出该读者的信息,确认是否删除该读者,1为删除,0为放弃。 (3)修改书籍:弹出修改读者的窗口,输入所要修改读者的学号(num),输出该读者的信息,确认是否修改该读者,1为修改,0为放弃。之后按照提示重新输入读者的信息。 5.搜索:此搜索包括两方面的搜索,书籍搜索以及读者搜索,弹出搜索的窗口,按照提示输 入所要搜索的内容,1为书籍搜索,2为读者搜索: (1)搜索书籍:弹出搜索书籍的窗口,按照提示输入所要搜索的方式,包括按<1>书名搜索, <2>书号搜索,<3>作者搜索,<4>出版社搜索,<5>出版时间搜索;根据所选方式输入相 应的内容,若是该书籍存在,则输出该书籍的信息,否则,返回主界面。 (2)搜索读者:弹出搜索读者的窗口,按照提示输入所要搜索的方式,包括按<1>名字搜索, <2>学号搜索;根据所选方式输入相应的内容,若是该读者存在,则输出该读者的信息, 否则,返回主界面。 6.退出:退出图书管理系统。 图书类设计:

用VB设计图书管理系统

摘要 随着人类社会的发展,人类对知识的需求也不断地增长。在这种形势下,书籍就渐渐地成为人们获取并增长知识的主要途径,而图书馆就自然而然地在人们的生活中占据了一定的位置。绘本图书与其他普通图画书的区别在于绘本图书通常有独立的绘画著者,图画有个人风格,画面即情即景,可单幅成画,容易提高儿童读书的积极性。如何科学地管理绘本馆不但关系到读者求知的方便程度,也关系到绘本馆的发展,因此,开发一套完善的绘本图书馆管理系统就成不可少了,图书管理系统是典型的信息管理系统(MIS),其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。 经过分析,使用Microsoft公司的Visual Basic6.0为开发工具,利用其提供的各种面向对象的可视化开发平台作为开发工具,采用面向对象技术,图形化的应用开发环境,尤其是它有一个功能极其强大的集成环境提供级开发人员,使得开发人员可通过菜单、界面、图形浏览工具、对话框以及嵌入的各种生成器来轻松地完成各种复杂的操作。开发过程中不断修正和改进,直到形成用户满意的可行系统。 本文介绍了在Visual Basic6.0环境下采用“自上而下地总体规划,自下而上地应用开发”的策略开发本系统的详细过程,提出实现绘本图书馆信息管理、资源共享的基本目标,从而推动迈向数字化绘本图书馆的步伐,并阐述系统结构设计和功能设计,从绘本图书的入库登记到查询浏览,形成了一个整体自动化管理模式,从软件工程的角度进行了科学而严谨的阐述。 关键词:绘本;图书管理系统;Visual Basic6.0 I

Abstract With the development of society , Mankind need more knowledge also constantly increase, Under such circumstances, book gradually become the main path to obtain the knowledge of life, and library naturally occupied in people certainly position, how science ground the management library not only relate to the convenient degree that the reader beg to know, but also relate to the library that strategy of development, therefore, develop the management system of a perfect library can't little, Library management system is a typical management information system (MIS), which mainly includes the establishment of database and front-end application maintenance and development of the two. After analysis, the use of Microsoft's development tool Visual Basic6.0 for the use of its various kinds of object-oriented visual development platform as a development tool, object-oriented technology and graphical application development environment, especially its There is an extremely powerful level of integration environment to provide developers, allowing developers through the menu, interface, graphical browsing tools, dialog boxes, and a variety of embedded generators to easily complete a variety of complex operations. Development process, constantly revised and improved, until users are satisfied with it. This paper introduced under the Visual Basic6.0 the environment adoption" from top to bottom total programming, from the detailed process that bottom but up applied development" develop this system, from the step that but the push head into the arithmetic figure of the library, and shows the system construction design and function design, from the books of store in warehouse to register the search to view, books that issue from library card to angle of borrow , become a the whole automation the management the mode, and proceeds careful explain from the software engineering science. Keywords:library; borrow; search to view; Visual Basic6.0

Java图书管理系统-附源码

目录 题目简述 -------------------------------- 01 需求分析 -------------------------------- 01 数据结构 -------------------------------- 01 功能模块 -------------------------------- 02 程序设计 -------------------------------- 02 运行截图 -------------------------------- 04 分析总结 -------------------------------- 08 程序源码 -------------------------------- 08

图书信息管理系统 题目简述: 题目名称:图书信息管理系统 要求:使用图形用户界面,用数据库建立1或2个图书信息表,能连接数据库并实现查询、增加、删除、修改等功能。 需求分析: 图书信息管理系统应该具备图书的信息管理功能和流通管理功能。其中,信息管理功能包括查找,增加,修改,删除,显示全部信息等模块。流通管理功能包括图书借阅,归还等模块。因此分别设计各个模块,实现不同的功能。 数据结构: 用SQL Sever 建立数据库的表,用一张表存放图书的ID号码,图书名称,图书的所有者,图书状态,图书的使用者(允许为空)。具体设计如下图所示: 图书ID,图书名称,图书所有者,图书的状态,图书使用者(允许为空)均为varchar(50)类型,在Java中可以方便的查询。图书存储信息的具体内容如下图所示:

功能模块: 程序设计: 主框架设计: 主框架上方包含三个按钮,分别是“系统管理”、“图书信息管理”和“图书流通管理”,定义JMenuBar类的对象、JMenu类的对象和JMenuItem类的对象,分别表示菜单栏、菜单组和菜单选项,然后调用初始化函数,将不同类的对象通过setText()函数设定不同的文本,然后将其添加到窗口容器中。对每个按钮分别添加不同的消息监听,响应相应的消息,调用不同的类完成不同的功能。消息监听功能详见源代码bookMain类。 图书信息管理模块包括增加图书,删除图书,编辑图书,查找图书和显示图书信息。具体的方法实现在bookBean中实现,当用户点击相应的按钮时,消息监听模块就会调用bookBean的构造函数产生一个bookBean的对象,然后通过对象调用bookBean类中的相应方法,完成事件的相应。 增加图书信息模块: 调用bookAdd类的构造函数产生一个该类的对象,在初始化函数中显示信息输入对话

用VB编写一个简单的图书管理系统

用VB编写一个简单的图书管理系统 Srl2011009(学号)石二辽(姓名)指导教师徐哲鑫 【摘要】笔者采用Visual Basic 为开发工具,设计一款具备友好的图形用户界面、简便操作的图书管理系统。充分利用计算机功能实现读者管理、书籍管理、借还书籍管理等信息的自动化控制,将使图书管理员从繁杂、重复的劳作中解放出来。 【关键词】图书;面向对象;软件工程 1概述 开发背景 用计算机管理图书馆里一切信息是一种计算机应用技术的创新,在计算机还未普及之前图书管理都是由图书管理人员手工记帐的方式来操作的.现在一般的图书馆都是采用计算机作为工具,使用实用的图书管理程序来帮助图书馆管理员进行更有效的图书管理。 图书管理系统产生的背景 图书管理系统是典型的信息管理系统,其开发主要包括后台数据库的建立和维护以及前端应用程序的开发两个方面。对于台数据库的建立和维护要求建立起数据一致性和完整性强、数据安全性好的库。而对于前端应用程序则要求应用程序具备功能完备、友好的图形用户界面、便捷使用等特点[1]。 系统功能要求的分析 开发本系统的总体任务是实现图书管理系统的系统化和自动化,帮助图书管理员更好更高效地完成图书管理工作,本系统要完成的功能主要有: 书籍管理部分:图书类别管理和图书信息管理。其中,书籍类别管理包括添加书籍类别、修改书籍类别、删除书籍类别等;书籍信息管理包括书籍信息的添加、修改、查询、删除等。 读者管理部分:读者类别管理和读者信息管理,读者类别管理包括读者类别添加、修改、删除等;读者信息包括读者添加读者信息、修改读者信息、查询读者信息、删除读者信息等。 借阅管理部分:借书信息管理和还书信息管理,借书信息管理、还书信息管理均包括其信息的添加、修改、查询等。 系统管理部分:添加管理员,修改密码,退出系统。 2开发环境及实现技术介绍

图书管理系统含源代码可以运行

第一章需求分析 1.1设计内容 利用c++的文件操作能力设计开发一个小型的图书管信息管理系统,至少具有如下功能:查寻所有图书信息、通过输入图书编号来完成查找某一本图书信息、添加图书信息、删除图书信息以及通过学生学号实现图书借阅功能。操作界面要符合用户的一般习惯,界面易于读者明白理解,图形或文本界面都可以。 1.2 设计任务 要求:明确课程设计的目的,能根据课程设计的要求,查阅相关文献,为完成设计准备必要的知识;提高学生用高级语言进行程序设计的能力,重点提高用C++进行文件操作和绘图应用的编程技术水平;初步了解软件开发的一般方法和步骤;提高撰写技术文档的能力。掌握模块化编程的基本方法与步骤;巩固和加深学生对C++课程基本知识的理解与掌握,培养学生利用C++进行软件操作的能力和技巧。 1.3 基本要求 (1)通过提示菜单选择可以进行的操作。 (2)将图书的信息存入文件中,并命名为BookInfo.txt。 (3)将图书借阅情况信息存入文件中,并命名为SendInfo.txt。 (4)在本系统中可以进行管理系统包含的基本操作,其中包括: a)查看所有图书的信息。

b)输入一本图书的图书编号,从当前图书中进行查找,如果找到则显示该图书的相关信息,如果没有找到则给出提示信息。 c)添加一本图书的基本信息,通过输入图书编号,首先查找是否存在该图书编号的图书,如果存在则提示重新输入,否则将该图书按照顺序插入到相应位置。 d)删除一本图书的基本信息,通过输入图书编号,首先查找是否存在该图书编号的图书,如果存在则将该图书删除,否则给出提示信息,提示该图书不存在。 e)借阅一本图书,需要给出学号和图书编号,如果图书编号不存在则重新输入,直到输入正确为止,并将学号和相应的图书编号存入SendInfo.txt文件中。 (5)图书基本信息包括图书编号、书名、作者、出版社和价钱这些简单信息。 (6)图书信息文件中每一行存放一本图书的信息。 (7)借阅信息文件中每一行存放一本书的借阅情况。 (8)对老师.学生的信息进行登记处理,包括姓名、学号教师编号、学院班级等。 (9)对图书的金额进出管理,对一丢失的图书进行处罚、对超期归还的图书进行赔偿金额计算。 第二章系统功能设计

图书馆管理系统程序的设计代码

1.1程序设计代码 登录模块 if(username.Text.Trim()==""||password.Text.Trim()=="") MessageBox.Show("请输入用户名和密码","提示"); else { if (radioManage.Checked == true) { string strcon = "Data Source=SIMON-VAIO;Initial Catalog=lkl2;Integrated Security=True;"; //连接数据库的字符串,用于指定数据库地址,名称,账号,密码,连接方式SqlConnection sqlCon = new SqlConnection(strcon); //实例化并定义一个数据库连接 sqlCon.Open(); //打开数据库连接 string sql = "select * from login where usernum=usernum and userpassword=suerpassword"; //定义要查询sql语句 SqlCommand cmd = new SqlCommand(sql, sqlCon); //实例化并定义sql语句和数据库路径 cmd.Parameters.Add("usernum", SqlDbType.NChar, 20); //定义cmd查询命令的字段属性,loginname sqldbtype nchar(20) cmd.Parameters.Add("suerpassword", SqlDbType.NChar, 20); //同上 cmd.Parameters["usernum"].Value = username.Text; //将username中的text保存到变量loginname cmd.Parameters["suerpassword"].Value = password.Text; //同上 SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { this.Visible=false; Form2 Formmain = new Form2(); //应该是实例化一个主窗体的 this.Hide(); //应该是切换到主窗口的或关闭自己的 Formmain.Show(); //应该是打开一个主窗体的 dr.Close();//关闭dr的数据库连接 } else// if (dr.Read())读取失败则执行如下代码 MessageBox.Show("密码错误,请重新输入!"); //显示提示信息 } else if (radioPerson.Checked==true)

图书管理系统的C#代码(完整版)

C#代码清单 共1个项目,包含5个类。 项目:librarysystem 类: Program.cs Readers.cs Manage.cs Menu.cs Publications.cs 主类代码: namespace librarysystem { ///

///类名:Program ///功能:项目主类 ///时间:2015-11-19 /// class Program { static void Main(string[] args) { Menu meu = new Menu(); meu.ShowMainMenu(); Console.ReadLine(); } } } 出版物类代码: namespace librarysystem { /// ///类名:Publications ///功能:馆藏出版物信息 ///时间:2015-11-19 /// class Publications { /*出版物编号*/ private string PublicationISBN; public string PublicationIsbn { get { return PublicationISBN; }

{ PublicationISBN = value; } } /*出版物名称*/ public string PublicationName; /*出版物作者或出版机构*/ public string PublicationAuthor; /*出版物在架状态*/ public bool PublicationStatus; /*出版物类型*/ public string PublicationType; public Publications() { } public Publications(string PublicationISBN,string PublicationName,string PublicationAuthor,string PublicationType,bool PublicationStatus) { this. PublicationISBN = PublicationISBN; this.PublicationName = PublicationName; this.PublicationAuthor = PublicationAuthor; this.PublicationType = PublicationType; this.PublicationStatus = PublicationStatus; } } } 读者类代码: namespace librarysystem { ///

///类名:Readers ///功能:已获取权限读者的信息 ///时间:2015-11-19 /// class Readers { private string ReaderID; public string ReaderId { get { return ReaderID; } set

基于java的图书管理系统源代码

基于java的图书管理系统源代码声明:本系统是基于C/S的图书管理系统,主要使用的是Oracle数据库,下面附所有实现代码 package library; import java.awt.BorderLayout; import java.awt.Container; import java.awt.GridLayout; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.sql.ResultSet; import javax.swing.JButton; import javax.swing.JComboBox; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JOptionPane; import javax.swing.JPanel; import javax.swing.JTextField; public class book_add extends JFrame implements ActionListener{ DataBaseManager db=new DataBaseManager(); ResultSet rs; JPanel panel1,panel2; JLabel book_id_label,book_name_label,author_label, press_label,press_date_label,price_label,book_num_label,borrowed_num _label,a ddress;

图书馆管理系统源代码

源程序清单 1、文件名 login(login.frm) 功能说明:整个系统的登陆界面,需要输入用户名和登陆密码才能进入到系统中,进行借阅等操作。 源代码: Option Explicit Dim cnt As Integer Private Sub Command1_Click() Dim sql As String Dim rs_login As New ADODB.Recordset If Trim(Combo1.Text) = "" Then MsgBox "没有这个用户", vbOKOnly + vbExclamation, "" Combo1.SetFocus Else sql = "select * from 系统管理 where 用户名='" & Combo1.Text & "'" rs_login.Open sql, conn, adOpenKeyset, adLockPessimistic If rs_login.EOF = True Then MsgBox "没有这个用户", vbOKOnly + vbExclamation, "" Combo1.SetFocus Else If Trim(rs_login.Fields(1)) = Trim(txtpwd.Text) Then userID = Combo1.Text rs_login.Close Unload Me form1.Show Else MsgBox "密码不正确", vbOKOnly + vbExclamation, "" txtpwd.SetFocus End If

End If cnt = cnt + 1 If cnt = 3 Then Unload Me End If Exit Sub End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub Form_Load() Dim connectionstring As String connectionstring = "provider=Microsoft.Jet.oledb.4.0;" & _ "data source=book.mdb" conn.Open connectionstring cnt = 0 End Sub Private Sub txtuser_Change() End Sub 2、文件名 form1(form1.frm) 功能说明:整个系统的主界面,其中包括图书管理、读者管理、图书借阅管理、系统管理、关于,以及在这下面的子菜单。 源代码: Private Sub add_admin_Click() frmadduser.Show End Sub Private Sub add_back_book_Click() frmbackbookinfo.Show

图书馆管理系统代码

#include #define DEBUG 0 //宏定义决定测试代码是否编译0为不编译非0则编译 const char book_path[20] = "books.txt"; const char reader_path[20] = "readers.txt"; //文件读写声明 void read_from_files_to_vector(); void write_all_to_files(); #if DEBUG void scan_readers() { for(reader &s:readers) { wcout << s; }

} #endif int main() { //完成操作后需要在控制台按5中退出才会保存到文件 wcin.imbue(china); wcout.imbue(china); read_from_files_to_vector(); #if DEBUG cout << "size of readers = " << readers.size() << endl; cout << "size of books = " << books.size() << endl; scan_book(); scan_readers(); #endif

string password = "123456"; //密码已改 cout << "------------欢迎使用中南大学网络在线图书系统------------"<> a; cleanScreen(); if (a == 1) { string str; for (int j = 0; j <= 4; j++) { cout << "请输入管理密码,你有" << (4-j) << "次机会" << endl; cin >> str;

图书馆管理系统设计附带源代码

毕业设计_图书管理系统 一、数据库设计数据库设CREATE DATABASE TSGL GO USE TSGL GO CREATE TABLE Bmanage ( bId varchar(10) PRIMARY KEY, bName varchar(50), --添加图书--图书编号 --书名 bNumber varchar(10), --书数目) GO bSore varchar(50) --分类 CREATE TABLE Madmin ( mName varchar(10)PRIMARY KEY, mPwd varchar(25), mAge varchar(8), mSex varchar(4), mNumber varchar(15), mrole varchar(8) ) GO --图书员管理 --图书管理员姓名--图书管理员密码 --图书管理员年龄 --图书管理员性别 --图书管理员电话 --图书管理员角色

CREATE TABLE Reader ( rSno varchar (10) PRIMARY KEY , rName varchar (10), rPwd varchar (25), rAge varchar (8), rSex varchar (4), rState varchar (8), rNumber varchar (15), rEmail varchar (25), --读者信息表reader --读者号 --姓名 --密码 --年龄 --性别 --状态 --电话号码 --电子邮件rAdress varChar (50), --地址) GO rGrade varChar (15), rClass varchar (15), rRole varchar (8) --年级 --班级 --角色 CREATE TABLE Rrecord ( rSno varchar (10) PRIMARY KEY , rName varChar (10), bId varchar (10), bName varChar (50), bTime varchar (10), bBackTime varchar (10) ) GO CREATE TABLE SysSet ( rRole varchar (8)PRIMARY KEY , rState varchar (8), Fine float (25), rDay varchar (8) --读者编号学号 --读者姓名 --图书编号 --图书名称 --借书时间 --还书时间 --读者角色 --读者可借书数 --过期罚款设置 --可借书天数 ) 二、界面截图及说明 1) 登录窗口(实现管理员与馆长的登陆)

VBnet图书管理系统

目录 1登录窗体模块组成 (1) 2各窗体介绍 (1) 2.1登录窗口 (1) 2.2登录成功后的主窗口实现 (1) 2.3登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) 2.1登录窗口 (1) I

I 1登录窗体模块组成 1登录窗口 2数据库连接定义窗口 3读者增加 4学生借书与查询历史窗口 5书籍借阅历史 6主窗口 7读者选择 8增加书籍 9书籍选择 10管理员增加 2各窗体介绍 在窗体Module1.vb 中定义了数据库的连接,每次读完数据库都将数据库连接关闭,在每次需要用到数据库的时候打开连接就可以了,以免以后每次用到数据库都要重新定义连接。其定义如下 Public constr As String = "User ID=sa; Password=; database=homework; server=(local)" Public mycon As New SqlConnection(constr) Public mycom As SqlCommand Public myda As SqlDataAdapter 2.1 登录窗口 图2登录窗口界面 其登录按钮代码为: If ComboBox1.Text = "" Or TextBox1.Text = "" Then MessageBox.Show("用户名或密码不能为空", "提醒", MessageBoxButtons.OK, MessageBoxIcon.Exclamation) 此句的作用是判断用户名或者密码是否为空 Dim sqlstr As String = "select Count(*) from Administrator Where Name='"

图书管理系统程序代码

模块设计 基础模块 SqlSession: 利用mybatis获取jdbc,其中有inter.select,update,select等方法 String resource = "mybatis-config.xml"; InputStream inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(inputStream); SqlSession sesson = sqlSessionFactory.openSession(); Dao基础模块 所有的dao都继承于BaseDao; 代码 /** *保存利用mybatis的xml * model 保存的对象 *id mybatis的id名 */ Public void Save(BaseModel model,String id){ sesson.inster(id model); } …… Model基础模块 所有的模型都继承于BaseModel; 代码片段 /** *字段编号 */ Private int id; Public void setId(String id){ This.id = id; } Public String getId(){

Return id; } 添加书籍 代码片段 Book book = new Book(); book.setId(…..); …….. Book.setTitle(….); BooksManageDao bookDao = new BooksManageDao(); bookDao .save(“addBook”,book); 删除书籍 代码片段 BookDao bookDao = new BookDao(); Book book = (Book) bookDao .getModel(id); BooksManageDao bookDao = new BooksManageDao(); bookDao .delete(“delete Book”,book); 更新书籍

图书管理系统程序代码

#i n c l u d e<> #include <> #include <> #define SIZE (struct booklist *)malloc(sizeof(struct booklist)) .(Y/N) :"); ch = getchar(); if(ch == 'y' || ch == 'Y') store(head); getchar(); break; } case 2: { if(head == NULL ) { printf("请先录入图书源信息!\n"); getchar(); break; } else { borrow_head = borrow_creat(head); .(Y/N) :" ); ch = getchar(); if(ch == 'y' || ch == 'Y') borstore(borrow_head); getchar(); break; } } case 3: { if(head == NULL ) { printf("请先录入图书源信息!\n"); getchar(); break; } else { flag = pre_creat(head); if(flag == 1)

printf("没有录入预借图书信息!\n\n"); if(flag == 2) pre_head = prebor_creat(); .(Y/N) :"); ch = getchar(); if(ch == 'y' || ch == 'Y') store(head); getchar(); break; } } case 4: .(Y/N) :"); ch = getchar(); if(ch == 'y' || ch == 'Y') store(head); getchar(); break; } } case 5: .(Y/N) :"); ch = getchar(); if(ch == 'y' || ch == 'Y') store(head); getchar(); break; } } case 9: .)\n\n"); printf("请选择功能:"); scanf("%d", &n); getchar(); if(n == 0) { x = 0; } getchar(); } else { printf("请输入学号:"); gets(c); strcpy(p -> prebook_num, a); strcpy(p -> prestu_num, c); if((fp = fopen("","a+")) == NULL)

VB图书管理系统

1、概述 为适应教育现代化的迫切要求,提高高校图书馆的现代化管理水平,提高图书馆使用效率,更好的配置图书资源,降低工作人员劳动强度;结合本人实际兴趣及知识,开发了此软件。 2、详细设计 2.1.系统功能模块图 2.2. 数据流图: 3.数据库设计 3.1 数据库概念结构设计:

3.2数据库逻辑结构的设计 包括有系统用户表yonghu、读者表duzhe、图书表tushu、借阅表jieshu、设置表shez。 图书表tushu 字段名称类型说明 图书编号文本 书名文本 作者文本 出版社文本 单价文本 本数文本 已借出数文本 借出次数文本 读者表duzhe 字段名称类型说明

借阅表jieshu 设置表shez

续借期限整型 最大借书数整型 4、主要功能模块设计 4.1.系统登陆界面设计 功能介绍: 用户选择用户名并输入密码,系统按用户名查看yonghu表,若密码正确,则按权限进入图书管理系统的主界面;若用户密码输入不正确,则系统提示出错,要求重新输入密码否则不得进入本系统。(注:还定义了一个模块名为 module1.bas ,pubyh和quanxian都是全局变量,一个保存用户名,一个保存权限、还有hsqx 、xjqx 、zdjss用于保存还书期限、续借期限、最大借书数。) 代码实现: Private Sub Command1_Click()

Adodc1.RecordSource = "select * from yonghu where 用户名='" & DataCombo1.Text & "' and 密码='" & Text1.Text & "'" Adodc1.Refresh If Adodc1.Recordset.EOF = False Then pubyh = DataCombo1.Text quanxian = Adodc1.Recordset.Fields("权限") Me.Hide MDIForm1.Show Else

相关主题
相关文档 最新文档