1

I have finished a program using sql server and visual studio using c# language . I want to put the database on pc and the program that connected to that database on other PCs

I'm using this connection string in App.config :

<connectionStrings>
<add name="MWEConnectionString" connectionString ="integrated security=yes;initial catalog=MWDB;data source=.\sqlexpress"/>
</connectionStrings>

Should I change server name by pc external ip address? and according to sql server Should I use windows authentication or what? I don't know how to do it.

2 Answers 2

5

You should access the server by it's address by using Sql Server authentication.

Your connection string should look something like this:

connectionString="Data Source=192.168.0.5\SQL2008R2;Initial Catalog=MWDB;Persist Security Info=True;User ID=user;Password=password"

(this is just an example, your settings will probably be different).

Another example:

connectionString="Data Source=NAMEOFCOMPUTER\SQL2008R2;Initial Catalog=MWDB;Persist Security Info=True;User ID=user;Password=password"

for accessing the server by name.

You can generate a connection string for your application from Visual Studio. From Database Explorer -> Connect to Database

Sign up to request clarification or add additional context in comments.

Comments

2

see:
http://connectionstrings.com/sql-server-2005

http://connectionstrings.com/sql-server-2005#p1

2 Comments

+1 for the links. They give a wider view on the subject then just the specific problem the user has.
when I try to connect the program after setup it to remote sql server database ,it display that error: login failed for user 'user'The user is not associated with a trusted SQL Server connection and remote connection and sql server explorer is already running I don't know how to solve this problem can any body help me??

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.