📄 moddatabase.bas
字号:
Attribute VB_Name = "modDatabase"
'* Programmed by : Vivek Patel *
'* Contact : Email => vivek_patel9@rediffmail.com *
'* Website => www.VIVEKPATEL.cjb.net *
'=====================================================
'*****************************************************
'* Vote For Me : If you really enjoy this utility or *
' helped by any of the functionality *
' than plz. reward us by your VOTE. *
'*****************************************************
'=====================================================
Option Explicit
'Add Reference for Microsoft ADO 2.1 Library
'otherwise it won't work if u will try to copy & paste
'this code to your project.
'Declaration
'Public totBooks As String
Public fineAmt As String
Public maxDays As String
Public cn As Connection
Public rsUser As Recordset 'Recordset for users
Public rsPubId As New Recordset
Public rsCatId As New Recordset
Public rsClassId As New Recordset
Public rsLibraryId As New Recordset
Public rsBookId As New Recordset
Public rsBookInfo As New Recordset
Public rsPubInfo As New Recordset
Public rsCatInfo As New Recordset
Public rsClassInfo As New Recordset
Public rsUserInfo As New Recordset
Public rsMemberInfo As New Recordset
Public rsIssueInfo As New Recordset
'It creates connection and on successful connection
'allows to proceed other work
Public Sub main()
'Error Handling (Suppress Any Error during Program execution)
On Error Resume Next
'SETTINGs Implementations
'(Registry Coding) Red Alert!!!
'********************************
'Authentication Checks STARTs
Dim crackkey As String
'Read Registry for previous settings stored
crackkey = GetSetting(App.Title, "Settings", "CHECK")
If crackkey = "" Then
MsgBox "You are not using License Version" & vbCrLf & "Run the Crack Application available with download!!!" & vbCrLf & vbCrLf & "DON'T FORGET TO VOTE FOR LIBRAR SYSTEM", vbInformation, "Authentication Check"
End
End If
'Authentication Checks ENDs
'Total Book Issue Capacity
'Read Registry for previous settings stored
' totBooks = GetSetting(App.Title, "Settings", "TotalBooks")
' If totBooks = "" Then
' totBooks = Str(2) 'By Default allowing 2 books to issue
' SaveSetting App.Title, "Settings", "TotalBooks", CStr(2)
' End If
'
'Fine Amt per Day
'Read Registry for previous settings stored
fineAmt = GetSetting(App.Title, "Settings", "FineAmt")
If fineAmt = "" Then
fineAmt = Str(2) 'By Default Rs 2 per day
SaveSetting App.Title, "Settings", "FineAmt", CStr(2)
End If
'Maximum No. of Days Allowed
'Read Registry for previous settings stored
maxDays = GetSetting(App.Title, "Settings", "MaxDays")
If maxDays = "" Then
maxDays = Str(14) 'By Default 14 days
SaveSetting App.Title, "Settings", "MaxDays", CStr(14)
End If
'********************************
If App.PrevInstance = True Then
MsgBox "Library Management System is already open", vbInformation, "Library Management System"
Exit Sub
End If
'display splash screen for user patience
frmSplash.Show
DoEvents 'it allows splash screen to display
'Loading System Tray Icon
Load frmSYSTRAYICON
'Database Connection Code
Set cn = New Connection
cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.3.51;data source=" & App.Path & "\library.mdb;"
cn.CursorLocation = adUseClient
cn.Open
If cn.State = adStateOpen Then
'when no database connection error occurs
Set rsUser = New Recordset
rsUser.CursorLocation = adUseClient
rsUser.Open "Select user_id from user", cn, adOpenKeyset, adLockPessimistic
rsBookInfo.Open "select * from bookinfo", cn, adOpenKeyset, adLockPessimistic
rsPubId.Open "select publication_id from publication", cn, adOpenKeyset, adLockPessimistic
rsCatId.Open "select catid from cat", cn, adOpenKeyset, adLockPessimistic
rsClassId.Open "select Class_id from class", cn, adOpenKeyset, adLockPessimistic
rsLibraryId.Open "select Library_id from student", cn, adOpenKeyset, adLockPessimistic
rsBookId.Open "select book_id from bookInfo", cn, adOpenKeyset, adLockPessimistic
rsPubInfo.Open "select * from publication", cn, adOpenKeyset, adLockPessimistic
rsCatInfo.Open "select * from cat", cn, adOpenKeyset, adLockPessimistic
rsClassInfo.Open "select * from class", cn, adOpenKeyset, adLockPessimistic
rsUserInfo.Open "select * from user", cn, adOpenKeyset, adLockPessimistic
rsMemberInfo.Open "select * from student", cn, adOpenKeyset, adLockPessimistic
rsIssueInfo.Open "select * from Issue", cn, adOpenKeyset, adLockPessimistic
frmLogin.Show
Unload frmSplash
Else
'when database connection error occurs
MsgBox "Database Connection Error", vbCritical, "Library Management System"
End
End If
End Sub
'=====================================================
'*****************************************************
'* Vote For Me : If you really enjoy this utility or *
' helped by any of the functionality *
' than plz. reward us by your VOTE. *
'*****************************************************
'=====================================================
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -