0

I have created software in c#.net which has some database into it. After creating a .exe file it works fine in my system but after installing that application in another system it gives following error.

Error: A network-related or instant specific error occurred while establishing a connection to SQL server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL server is configured to allow remote connection. (provider: SQL Network Interfaces, error: 26 - Error locating server/instance specified).

I have tried installing SQL Server and .net framework in client's machine but still, it's not working.

Do I need to install anything else on the client's pc to run my application?

ywwy
  • 124
  • 1
  • 2
  • 18
  • Well what have you setup as his sql server, and connection string? Are you sure you have access to it? – BugFinder Apr 03 '19 at 14:56
  • You need to install Sql Server, create your database, configure the connectionstring of your application to use this database – Steve Apr 03 '19 at 14:56
  • It is likely that your client does not have access to whatever database you were using. Look at connection strings in your config – Hasta Tamang Apr 03 '19 at 14:56

3 Answers3

0

Check the connection string to the database. The connection string should point to the SQL database the Client has access to. Most of the time this is not the same as the one you are using while developing.

ywwy
  • 124
  • 1
  • 2
  • 18
0

Change connection string of localhost to IP address of Database PC.

  • Can u tell me a step by step process to do it because I'm a beginner at this? – virendra ahire Apr 03 '19 at 15:07
  • Yes go to code and change connection string line of localhost to server name. In order to figure out server name or IP address open CMD and write "ipconfig /all" –  Apr 03 '19 at 17:38
0

You are going to have to add a connectionstring to your App.config file.

    <connectionStrings>
        <add name="ConnectionString" connectionString="Data Source=PRANOYPC\SQLEXPRESS; Initial Catalog=DatabaseName; Integrated Security=True;" providerName="System.Data.SqlClient" 
    </connectionStrings>

If you are using Windows authentication you can leave Integrated Security = True if not you will have to provide the authentication for the Database.

Also you have to make sure that the Client has access to the database that you are trying to access.

Pranoy
  • 3
  • 4