serverconnect.bas
来自「原创VB+SQL影音租赁系统 醮简单 具体看里边的文本文档」· BAS 代码 · 共 31 行
BAS
31 行
Attribute VB_Name = "ServerConnect"
Public con As Connection
Dim rst As Recordset
Public Function Connect() As Connection
Set con = New Connection
'Set com = New Command
Set rst = New Recordset
Dim strserver As String
Dim struser As String
Dim strpass As String
Dim strbase As String
'On Error GoTo err
strserver = GetSetting("ServerInfo", "Sql server", "ServerName")
struser = GetSetting("ServerInfo", "Sql server", "ServerUser")
strpass = GetSetting("ServerInfo", "Sql server", "ServerPassword")
strbase = GetSetting("ServerInfo", "Sql server", "ServerBase")
With con
.ConnectionString = "user id =" & struser & ";password=" & strpass & ";data source=" & strserver & ";initial catalog =" & strbase
.Provider = "sqloledb"
'MsgBox struser
.Open
End With
'rst.Open " " & str & " ", con, adOpenDynamic, adLockOptimistic
'rst.Close
'con.Close
'err:
'MsgBox err.Description
'con.Close
End Function
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?