使微软访问使用TCP / IP而不是命名pipe道

即使只有TCP / IP可用,并且ODBCconfiguration为使用TCP / IP,我也有一个Microsoft Access数据库不断尝试使用命名pipe道联系相应的Microsoft SQL Server。 不可能将所有表再次与工作的ODBC链接。

我怎样才能解决这个问题?

使用SQL客户端configuration应用程序(在较早版本的SQL中为“客户端networking实用程序”),设置一个使用tcpip连接到服务器的命名服务(又名“别名”)。 将Access应用程序设置为使用您创build的指定服务/别名。

在更新版本的SQL中,这是通过“SQL Serverconfigurationpipe理器”工具在“SQL本机客户端configuration”区域中完成的,您可以在其中创build别名。

另一种适用于ADO的方法,我相信ODBC:在您的连接string中指定服务器和端口。 在SQL中,这是用逗号来完成的:

<sql server name or ip>,<port> 

例如

 mysqlserver2008instance,1433 

就我而言,samsmith的例子并不奏效。

不过,我通过使用这样的东西来解决它:

  Dim DB As DAO.Database Set DB = CurrentDb Dim Tdf As TableDef 'Loops through list of tables For Each Tdf In DB.TableDefs If Tdf.SourceTableName <> "" Then 'this checks if it actually is a odbc table as i do not want to change the connection string of local tables obviously If Not InStr(Tdf.Connect, "ODBC") = 0 And Not (Tdf.Attributes And dbAttachedODBC) = 0 Then Tdf.Connect = "ODBC;DSN=xxx;APP=MicrosoftR Access;WSID=A2200;DATABASE=xxx;Network=DBMSSOCN;TABLE=dbo." & Tdf.Name Tdf.RefreshLink 'Saves the changes made End If End If Next Debug.Print "Finished!" 

Network=DBMSSOCN是关键部分,它指定应该使用tcp。