SQL Server 2016连接字符串 [英] SQL Server 2016 Connection String

查看:97
本文介绍了SQL Server 2016连接字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前有一个Access 2010数据库,它使用窗口身份验证连接到sql server。  sql server的版本是2008 R2,并且正在升级到Sql server 2016. 我需要知道新连接字符串应该是什么。 
目前是

Sub CheckDBName()

Dim m As String

Dim i As Integer

Dim i2 As Integer

I currently have a Access 2010 databases that uses window authentication to connect to sql server. The version of sql server is 2008 R2 and is being upgrated to Sql server 2016.  I need to know what the new connection string should be.  It is currently

Sub CheckDBName()
Dim m As String
Dim i As Integer
Dim i2 As Integer

On Error Resume Next

m = CurrentProject.Connection.ConnectionString

i = InStr(m," Initial Catalog =")

i2 = InStr(m,&;; Data Provider =")

m = Mid(CurrentProject.Connection.ConnectionString,(i + 16), (i2 - (i + 16)))

如果m<> " XXXX"然后

   如果m ="XXXXXXX",然后

        MsgBox"您目前已连接到TEST DATABASE。 如果您认为错误地收到了此消息,请联系Production Control。"
$
   否则

        MsgBox"无法连接到XXXX DATABASE。 请联系生产控制。"
$
   结束如果

结束如果

CurrentProject.Application.SetOption"刷新间隔(秒)",600左右
结束子

On Error Resume Next
m = CurrentProject.Connection.ConnectionString
i = InStr(m, "Initial Catalog=")
i2 = InStr(m, ";Data Provider=")
m = Mid(CurrentProject.Connection.ConnectionString, (i + 16), (i2 - (i + 16)))
If m <> "XXXX" Then
    If m = "XXXXXXX" Then
        MsgBox "You are currently connected to the TEST DATABASE.  If you feel you have received this message in error, please contact Production Control."
    Else
        MsgBox "Connection to the XXXX DATABASE could not be made.  Please contact production control."
    End If
End If
CurrentProject.Application.SetOption "Refresh Interval (sec)", 600
End Sub

推荐答案

连接字符串应与以前相同,但有一点需要注意:如果数据库移动到新机器,那么您可能必须更改连接字符串中的服务器名称。这是我们在论坛中无法知道的事情,但你需要和你谈谈这个问题。

The connection string should be the same as before, with one caveat: if the database moves to a new machine, then you may have to change the server name in the connection string. This is something we cannot know in the forum, but you need to talk you IT folks about that.


这篇关于SQL Server 2016连接字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆