?? mainbas.bas
字號:
Attribute VB_Name = "Mainbas"
Option Explicit
'連接數據庫用
Public ADOcn As Connection
Private ADOrs As New Recordset
Public User As String
Public Sub Main()
Dim strAccess As String
strAccess = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DataBase\Librarydatabase.mdb"
'Do While (ADOcn Is Nothing)
Set ADOcn = New Connection
ADOcn.Open strAccess
'Loop
frml.Show
End Sub
'從數據庫中取數據
Public Function mbdOpen(biao As String, zu As String, value As String)
On Error Resume Next
ADOrs.ActiveConnection = ADOcn
ADOrs.CursorLocation = adUseClient
ADOrs.CursorType = adOpenDynamic
'ADOrs.CursorType = adOpenStatic
ADOrs.LockType = adLockOptimistic
ADOrs.Open "Select * From " + biao + " Where " + zu + "='" + value + "'"
End Function
Public Function mbdGet(yuan As String) As String
On Error Resume Next
If ADOrs.EOF Then
'MsgBox "沒有該借書證號!!!"
Exit Function
End If
mbdGet = Trim(ADOrs.Fields(yuan))
End Function
Public Function mbdClose()
On Error Resume Next
ADOrs.Close
End Function
Public Function cmdMouseDown(cmd As CommandButton)
cmd.Left = cmd.Left + 30: cmd.Top = cmd.Top + 30
End Function
Public Function cmdMouseUp(cmd As CommandButton)
cmd.Left = cmd.Left - 30: cmd.Top = cmd.Top - 30
End Function
Public Sub dong(l1 As Label, l2 As Label, o As Object, f As String, step As Integer)
'If k = False Then Exit Sub
With l2
If .Left <= o.Left Then
If f = "←↓" Then f = "→↓"
If f = "←↑" Then f = "→↑"
End If
If .Top <= 0 Then
If f = "→↑" Then f = "→↓"
If f = "←↑" Then f = "←↓"
End If
If .Left + .Width >= o.Left + o.Width Then
If f = "→↓" Then f = "←↓"
If f = "→↑" Then f = "←↑"
End If
If .Top + .Height >= o.Height Then
If f = "→↓" Then f = "→↑"
If f = "←↓" Then f = "←↑"
End If
If f = "←↓" Then .Left = .Left - step: .Top = .Top + step
If f = "←↑" Then .Left = .Left - step: .Top = .Top - step
If f = "→↓" Then .Left = .Left + step: .Top = .Top + step
If f = "→↑" Then .Left = .Left + step: .Top = .Top - step
End With
l1.Left = l2.Left: l1.Top = l2.Top
DoEvents
o.Refresh
End Sub
'密碼的加密解密算法
Public Function EDcode$(CharString As String, Key As Integer)
Dim X As Single, i As Long
Dim CharNum As Integer, RandomInteger As Integer
Dim CharSingle As String * 1
On Local Error GoTo EDcodeError
EDcode$ = ""
If Len(CharString) = 0 Then
EDcode$ = "1"
Exit Function
End If
X = Rnd(-Key)
For i = 1 To Len(CharString)
CharSingle = Mid$(CharString, i, 1)
CharNum = Asc(CharSingle)
RandomInteger = Int(256 * Rnd) And &H7F
CharNum = CharNum Xor RandomInteger
CharSingle = Chr$(CharNum)
EDcode$ = EDcode$ + CharSingle
Next i
Exit Function
EDcodeError:
EDcode$ = "0"
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -