📄 databaseconn2.frm
字号:
VERSION 5.00
Begin VB.Form DatabaseConn2
BorderStyle = 1 'Fixed Single
Caption = "连接数据库类型"
ClientHeight = 2640
ClientLeft = 45
ClientTop = 435
ClientWidth = 5130
LinkTopic = "Form1"
MaxButton = 0 'False
MDIChild = -1 'True
MinButton = 0 'False
ScaleHeight = 2640
ScaleWidth = 5130
Begin VB.CommandButton Command1
Caption = "ok! 连接"
Height = 495
Left = 1800
TabIndex = 3
Top = 1800
Width = 1575
End
Begin VB.OptionButton Option2
Caption = "ACCESS数据库"
Height = 615
Left = 2760
TabIndex = 1
Top = 840
Width = 1455
End
Begin VB.OptionButton Option1
Caption = "SQL数据库"
Height = 615
Left = 960
TabIndex = 0
Top = 840
Value = -1 'True
Width = 1455
End
Begin VB.Label Label1
Caption = "请选择连接数据类型:"
BeginProperty Font
Name = "华文新魏"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 1200
TabIndex = 2
Top = 360
Width = 2655
End
End
Attribute VB_Name = "DatabaseConn2"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Command1_Click()
If Option1.Value Then
'On Error GoTo A
'StudentManger.Adodc1.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=."
SQLconn = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=student;Data Source=."
conn = True
MsgBox "连接SQL数据成功!!", vbOKOnly + vbExclamation, "恭喜"
'A:
'MsgBox "连接SQL数据失败!!", vbOKOnly + vbExclamation, "对不起"
Else
'On Error GoTo b
'StudentManger.Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Student.mdb" & ";Persist Security Info=False;Jet OLEDB:Database password=psite"
ACCESSconn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Student.mdb" & ";Persist Security Info=False;Jet OLEDB:Database password=psite"
conn = False
MsgBox "连接ACCESS数据成功!!", vbOKOnly + vbExclamation, "恭喜"
'b:
'MsgBox "连接SQL数据失败!!", vbOKOnly + vbExclamation, "对不起"
End If
'Form1.Show
'Unload Me
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -