Reputation: 81
i made an app on c# which has database connection and application works fine on my developement pc! Application starts fine and everything else works fine which has nothing to do with DB but it throw an error when i try to execute query ? I have Dotnetfx 2.0 installed on target machine what do i need to? Sql server?
Error is: An error has occured while establishing a connection to the server. When connecting to SQL server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified
p.s. its my first db application =S
Upvotes: 0
Views: 275
Reputation: 51000
SQL Server is a completely separate application from the application you wrote and are distributing. If your application does not connect to an existing SQL Server running somewhere on the network you will have to install and configure SQL Server as part of your application's installation.
In addition you will either need to install / create a database as part of your application's installation, or else your application needs to be able to detect the absence of the database and build it itself on first startup.
Upvotes: 2
Reputation: 4555
Make sure your connection string looks something like this:
"Server=(local)\\SQLEXPRESS;Database=Your_DB_Name_Here;uid=sa;pwd=password;"
Upvotes: 1
Reputation: 31630
As Marek said, the connection string is the most likely culprit, and I believe on SQL 2008 you have to explicitly allow TCP connections via:
Upvotes: 1