📄 form1.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "连接Access"
ClientHeight = 1695
ClientLeft = 60
ClientTop = 345
ClientWidth = 5760
LinkTopic = "Form1"
ScaleHeight = 1695
ScaleWidth = 5760
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command1
Caption = "连接Access数据库"
Height = 495
Left = 960
TabIndex = 0
Top = 600
Width = 3735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
Dim con As Object
On Error GoTo ErrHandle
Set con = New ADODB.Connection
Dim strcon As String
strcon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data.mdb;Persist Security Info=False;"
con.Open strcon
If con Is Nothing Then
MsgBox "连接失败,请你检查数据库路径!"
Else
MsgBox "连接成功!"
End If
Exit Sub
ErrHandle:
MsgBox "连接失败,请你检查数据库路径!"
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -