📄 module1.bas
字号:
Attribute VB_Name = "Module1"
Option Explicit
Public str1 As String
Public Type templ
collegecode As String
collegename As String
publishinghouse2 As String
amount2 As String
contactperson2 As String
contactphone2 As String
contactadr2 As String
timefetch2 As String
orderingtime2 As String
End Type
Public Type preference_type
splash_switch As Byte
'language_switch As Byte
End Type
Public Type POINTAPI
X As Long
Y As Long
End Type
Public Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Public Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) As Long
Public username As String
Public Function ExecuteSql(ByVal Sql As String, MsgString As String) As ADODB.Recordset
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim sTokens() As String
On Error GoTo ExecuteSql_error
sTokens = Split(Sql)
Set cnn = New ADODB.Connection
cnn.Open ConnectString
If InStr("INSERT,DELET,UPDATE", UCase$(sTokens(0))) Then
cnn.Execute Sql
MsgString = sTokens(0) & "query successful"
Else
Set rst = New ADODB.Recordset
rst.Open Trim$(Sql), cnn, adOpenKeyset, adLockOptimistic
'rst.MoveLast
Set ExecuteSql = rst
MsgString = "searched" & rst.RecordCount & "records"
End If
ExecuteSql_Exit:
Set rst = Nothing
Set cnn = Nothing
Exit Function
ExecuteSql_error:
MsgString = "searching error:" & Err.Description
Resume ExecuteSql_Exit
End Function
Public Function ConnectString() As String
ConnectString = "FileDSN=通用教材管理系统.dsn;UID=sa;PWD="
End Function
Public Function Testtxt(txt As String) As Boolean
If Trim(txt) = "" Then
Testtxt = False
Else
Testtxt = True
End If
End Function
Public Sub Main()
Dim read_pre As preference_type
Dim record_no_pre As Integer
Open App.Path + "\preference.conf" For Random As #1 Len = Len(read_pre)
record_no_pre = LOF(1) / Len(read_pre)
Get #1, record_no_pre, read_pre
Close #1
If read_pre.splash_switch = "1" Then
frm_splash.Show
frm_sys_m.Check1.Value = 0
ElseIf read_pre.splash_switch = "0" Then
frm_login.Show
frm_sys_m.Check1.Value = 1
Else
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -