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

📄 moddatabase.bas

📁 多种图表的绘制及其运用
💻 BAS
字号:
Attribute VB_Name = "modDatabase"
'**************************************************
' Author : Vivek Patel
' Email : vivek_patel9@rediffmail.com
' Website : www.vivekpatel.cjb.net
'**************************************************


'Note : To Copy and Paste this code require to
'add reference => follow the instructions
'1> Project Menu => Reference
'2> Add Microsoft ActiveX Data Object Library 2.1

Option Explicit
Public cn As New ADODB.Connection
Public rs As New ADODB.Recordset


'Make Database Connection
Public Sub main()
    Dim path As String
    path = App.path & "\company.mdb"
    cn.ConnectionString = "provider=Microsoft.Jet.OLEDB.3.51;data source=" & path & ";"
    cn.Open
    If cn.State = adStateClosed Then
        MsgBox "Connection Error", vbCritical, "Error!"
        End
    Else
        Debug.Print "Connection Object Created"
        cn.CursorLocation = adUseClient
    End If
    
    'Setting Initial data for recordset
    rs.Open "Select * from companies", cn, adOpenDynamic, adLockOptimistic
    Debug.Print "Recordset Object Created"
    
    Call Form1.Show
End Sub

⌨️ 快捷键说明

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