Click here to Skip to main content
15,884,176 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have developed a window application on c# ASP.NET and i want to connect it with database on other system that is not having development environment.
when i install it on that system it should connect with the database but i am not clear that how to set sql server name of pc at installation time in app.config file. what path should i enter instead of data source and server name.
Please help...............
Posted

I am a little confused to what type of application that your are deploying? is it a windows application or a web form application?

But for reference I would also have a look at http://www.connectionstrings.com[^]. As this will show you how to construct / edit an existing connection string.
 
Share this answer
 
 
Share this answer
 
The only technical thing while connecting your database to an application is the connectionString that tells your application the actually destination of the data server, from where to access the data. SQL Server is actually a server that provides you with the data from Databases and so on.

You must be able to write the correct connectionString. Data is not liable to be present on the very computer you're actually working on. It can be present on some other source. (as in your case).

Here, connectionString would work, and you can provide the server address (name) to it, and the database to connect to.

Go to: http://www.connectionstrings.com/sql-server/[^] and you can see many connectionStrings that you can use, to refer to the data source. In every instance of the connectionString, there is a section (attribute of the connectionString) titled as Server. This attribute describes where actually in the world of computers, your server is located. Write the address of the server, local or remote, in that attribute. In your case, you are going to connect using IP address (or more options can be used from the site)

http://www.connectionstrings.com/sqlconnection/connect-via-an-ip-address/[^]

Upon connecting, the application will make a request for connection to the address, and the following would go as you code it out.
 
Share this answer
 
v2
Get the Connection string using UDL file

Open Notepad and save it as "ConnectionContext.udl"


Now open that file (ConnectionContext.udl) -> In provider tab select "Microsoft OLE DB Provider for SQL Server" (Not mandatory you can select your suitable provider ) -> Now click on Connection Tab -> Enter Your Server name and select your authentication mode if it is server mode enter your user id and password -> select your database -> Test Connection -> If Success closed the windows

Now open that udl file in Notepad you can see the connection string


If your two PCs are in same network / Work group then you can connect it by using windows / server authentication. but for windows you need to mention port no ( you need to add this port in firewall Outbound Rules.
 
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