📄 mglobal.bas
字号:
Attribute VB_Name = "mGlobal"
'Option Explicit
Public Cn As New ADODB.Connection
Public rs As ADODB.Recordset
'Public Declare Function GetTickCount Lib "kernel32" () As Long
'
'Public Function DelayTime(SecToDelay As Single)
'Dim MarkTime As Single
'MarkTime = GetTickCount
'Do While GetTickCount < MarkTime + SecToDelay * 1000 'Convert into Seconds
'DoEvents
'Loop
'End Function
Sub Main()
' Dim fLogin As New frmLogin
' fLogin.Show vbModal
' If Not fLogin.OK Then
' '登录失败,退出应用程序
' End
' End If
' Unload fLogin
'
'
' frmSplash.Show
' frmSplash.Refresh
' Set frMain = New FrmMain
' Load frmMain
' Unload frmSplash
'frmMain.Show
End Sub
Sub DBdelete(DbName As String, DBfields As String, DBstr As String)
Cn.Open "dsn=SerManage"
Set rs = New ADODB.Recordset
With rs
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "select * from " & DbName & " where " & DBfields & "='" & DBstr & "'"
.ActiveConnection = Cn
.Open
.Delete
.Close
End With
Cn.Close
End Sub
Sub DBaddNew(DbName As String, DBfields As String, DBstr1 As String, DBstr2 As String)
Cn.Open "dsn=SerManage"
Set rs = New ADODB.Recordset
With rs
.CursorType = adOpenKeyset
.LockType = adLockOptimistic
.Source = "select * from " & DbName & " where " & DBfields & "='" & DBstr2 & "'"
.ActiveConnection = Cn
.Open
If .RecordCount = 0 Then
.AddNew
.Fields(0) = DBstr1
.Fields(1) = DBstr2
.Update
.Close
Cn.Close
Else
MsgBox "输入信息已存在,请重输!", vbCritical, "提示"
.Close
Cn.Close
Exit Sub
End If
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -