⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module1.bas

📁 This was the public transportation inquiry system software engineering design documents, including t
💻 BAS
字号:
Attribute VB_Name = "Module1"
Option Explicit
Public strusername As String                   '用户登录姓名
Public iflag As Integer
Public ichangeflag As Integer
Public strpublicsql As String
Public userpassword As String                  '用户登录密码
Public Function getrs(ByVal sql As String, ByVal databasename As String) As ADODB.Recordset
  Dim con As ADODB.Connection
  Dim rs As ADODB.Recordset
  Dim strconnection As String
  Dim strarray() As String
  Set con = New ADODB.Connection
  Set rs = New ADODB.Recordset
  On Error GoTo getrs_error
      strconnection = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\"
      strconnection = strconnection & databasename & ".mdb"
      strarray = Split(sql)
      con.Open strconnection
          rs.Open Trim$(sql), con, adOpenKeyset, adLockOptimistic
          Set getrs = rs
          iflag = 1
getrs_exit:
   Set rs = Nothing
   Set con = Nothing
   Exit Function
getrs_error:
   MsgBox "查询错误:" & Err.Description
   iflag = 2
   Resume getrs_exit
End Function
Public Sub transactsql(ByVal sql As String, ByVal databasename As String)       '添加执行SQL语句命令的函数
  Dim con As ADODB.Connection
  Dim strconnection As String
  Dim strarray() As String
  Set con = New ADODB.Connection
  On Error GoTo transactsql_error
     strconnection = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\"
     strconnection = strconnection & databasename & ".mdb"
     strarray = Split(sql)
     con.Open strconnection
     con.Execute sql
     iflag = 1
transactsql_exit:
  Set con = Nothing
  Exit Sub
transactsql_error:
  MsgBox "查询错误:" & Err.Description
  iflag = 2
  Resume transactsql_exit
End Sub
Public Sub tabtoenter(key As Integer)
  If key = 13 Then                    '判断是否为回车键
  SendKeys "{Tab}"
  End If
End Sub
Sub main()
  frmlogin.Show
End Sub

⌨️ 快捷键说明

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