Article ID: 313295 - View products that this article applies to.
This article was previously published under Q313295
This article describes how to programmatically specify the client network library in the connection string when you connect to a SQL Server database.
In Microsoft Data Access Components (MDAC) 2.6 and later, you can specify the client access library by using the server name parameter in connection string. Therefore, you can specify a specific client access library when you are prompted by an application for a server name to which to connect. This behavior can be very useful when you are testing and troubleshooting connectivity issues for SQL Server.
For example, you can use the Osql command-line utility to connect to SQL Server and to force it to use the TCP/IP network library:
Code SampleThe following Microsoft Visual C# .NET code sample demonstrates how to set the connection string. The connection string has the same format irrespective of the language that you use:
Note the connection string and particularly the value of the server parameter:
Use the Code Sample with Various Network LibrariesThe following code samples demonstrate how to use the value of the server parameter to specify various network libraries:
For more information, visit the following Microsoft Web site:
Article ID: 313295 - Last Review: November 30, 2005 - Revision: 6.5
Contact us for more help