c# - Sql Server 2005 localhost System DSN not working -


I have a C # .NET 3.5 executable which runs on the local machine and the database server to run SQL Server In 2005, I used System DSN (using a driver with SQL Server on the server) using the Data Source Manager on a local machine named "LocalServer". When I make DSN, I can successfully test the connection to the server.

I added the local connection to my connection string in my executable, and I get an error "An error occurred while establishing connection to a network related or example-specific SQL Server. Was not found or was not accessible. Verify that the example name is correct and SQL Server is configured to allow remote connection. (Provider: Nami The Pipes provider, Error: 40 - does not open any connection to the SQL Server) "

The server connecting that allows the remote connection when I change the local names to the server name, this fix , But this program will be in multiple locations with multiple server names, so I need to make the data source dynamic.

Why is such an idea

edit:

I also have "local server, 1433" my data As a source, but I get this error: "A network related or instance-specific error occurred when installing a connection to SQL Server. The server was not found or was not accessible. Verify that the name of the example is Is correct and to allow remote connections to that SQL Server Is configured (Provider: TCP provider, error: 0 - No such host is known.) "

Edit:

Your answers Thanks to, to solve my problem, I have made a small method to collect the synerm using an ODBC connection.

Then I can send the server name to the SRL connection. Thanks again for your input.

SQLAquilient (i.e. SQL Connection) is not to do absolutely anything with the ODBC such as the SDL client in a connection string Using the ODBC Data Source You will not get anywhere faster

You can configure the server name in app.cconfig and use the connection string by using it. On deployment, you change the exe or user's .config file appropriately.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -