Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
My code is below
XML
<configuration>
    <configsections>
    </configsections>
    <connectionstrings>
        <add name="LatTejDB" connectionstring="Data Source=RAJ;Initial Catalog=NewMilkSupply;Integrated Security=True" providername="System.Data.SqlClient" />
    </connectionstrings>
    
    <startup> 
    	<supportedruntime version="v4.0" sku=".NETFramework,Version=v4.0" />
    </startup>
</configuration>

Using this code, my application runs only on my computer.
I want it to run on another computer.
Posted
v3
Comments
[no name] 13-Sep-13 6:24am    
Okay so change your connection string. How are we supposed to know what errors you are getting?
Are you using Windows Authentication?

Don't put installation specific things (like connection strings) into the app.config.
Put it somewhere else. Either in a new config file that is stored in the running users AppData (or equivalent) folder or take it as a start-up argument.

If your application has a UI you can ask for the connection string if none is configured and then write it to a user specific config file that is used next time the application starts.

Hope this helps,
Fredrik
 
Share this answer
 
XML
<add name="LatTejDB" connectionstring="Data Source=RAJ;Initial Catalog=NewMilkSupply;Integrated Security=True" providername="System.Data.SqlClient" />

From the ConnectionString, it is clear that you are trying to connect to some Server RAJ.

For that, you need to Enable TCP/IP and Named Pipes in SQL Server Configuration Manager.
Refer - Enable Named Pipes and TCP/IP Connections[^] to know how to Enable it.

I am just taking the steps from there and listing them below.
  1. Select Start, and in your list of programs, select SQL Server Configuration Manager.
  2. Navigate to SQL Server Configuration Manager > SQL Server Network Configuration > Protocols for <machine instance>.
  3. Double-click Named Pipes. The Named Pipes Properties screen appears.
  4. From Enabled, select Yes. Then click OK.
  5. Double-click TCP/IP. The TCP/IP Properties screen appears.
  6. On the Protocol tab, ensure Yes is selected for Enabled. On the IP Addresses tab, ensure that Yes is selected for the appropriate IP Address. Also, ensure that the appropriate TCP Port is indicated.
  7. Click OK.
  8. From SQL Server Management Studio, restart the server instance.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900