module1.bas

来自「VB下的航空公司信息管理系统.关键词: 航空公司管理系统」· BAS 代码 · 共 85 行

BAS
85
字号
Attribute VB_Name = "Module1"
Public fMainForm As frmMain
Public gintSmode As Integer 'for service
Public gintPmode As Integer 'for plane
Public gintAmode As Integer 'for airline
Public gintTmode As Integer 'for customertype
Public gintCmode As Integer 'for customer
Public gintKmode As Integer 'for ticket
Public puser As New ProUser.ClsMain

Sub Main()
'    Dim fLogin As New frmLogin
    puser.frmLoginShow
    If puser.frm_show = True Then
        Set fMainForm = New frmMain
        fMainForm.Show
    Else
        End
    End If
    
'    If Not fLogin.OK Then
'        'Login Failed so exit app
'        End
'    End If
'    Unload fLogin
'
'    Set fMainForm = New frmMain
'    fMainForm.Show

End Sub


Public Function ExecuteSQL(ByVal SQL _
   As String, MsgString As String) _
   As ADODB.Recordset
'executes SQL and returns 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.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Ticket;Data Source=."
   cnn.Open
   If InStr("INSERT,DELETE,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     'get RecordCount
      Set ExecuteSQL = rst
      MsgString = "查询到" & rst.RecordCount & _
         " 条记录 "
   End If
ExecuteSQL_Exit:
   Set rst = Nothing
   Set cnn = Nothing
   Exit Function
   
   
ExecuteSQL_Error:
   MsgString = "查询错误: " & _
      Err.Description
   Resume ExecuteSQL_Exit
End Function
Public Sub EnterToTab(Keyasc As Integer)
    If Keyasc = 13 Then
        SendKeys "{TAB}"
    End If
End Sub
Public Function GetRkno() As String
    GetRkno = Format(Now, "yymmddhhmmss")
    Randomize
    GetRkno = GetRkno & Int((99 - 10 + 1) * Rnd + 10)
End Function


⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?