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

📄 module1.bas

📁 公寓管理信息系统的基本功能的设计~~~~~~~~
💻 BAS
字号:
Attribute VB_Name = "Module1"
Public Function connectdatabase() As Boolean
ConnectionString = "provider=sqloledb.1;persist security info=false;user id=sa;initial catalog=stu;datasource=localhost"
Set con = New ADODB.Connection
con.ConnectionString = ConnectionString
con.coursorlocation = adUseClient
con.CommandTimeout = 500
On Error GoTo error_proc
    If con.State = 0 Then
    con.Open
    con.connectdatabase = True
    Exit Function
 End If
error_proc
  If Err.Number = -21477467259# Then
     MsgBox "找不到数据库,请检查", vbOKOnly + vbExclamation, "警告"
  Else
      MsgBox "未知错误", vbOKOnly + vbExclamation, "错误"
  End If
  connectdatabase = False
End Function

Public fMainForm As MIDForm1
Public UserName As String
Sub Main()
ConnString = "Driver=Microsoft Access Driver(*.mdb);DBQ=" & App.Path & "\db1.mdb"

Form1.Show vbModal
If Form1.OK Then
  MIDForm1.Show
  Unload Form1
Else
  MsgBox "无权登录本系统", , "登录"
  End
End If
End Sub

'创建字符串连接函数

⌨️ 快捷键说明

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