Click here to Skip to main content
15,888,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,
I have a c# application which has been under development for a while and for this purpose it is connected to a MS SQL Express 2010 database on the development PC. This has worked well but now I need to move to the next stage and connect to a remote SQL Standard 2005 server database. The connection string that I have used until now has been:

connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\Rulesdb2.mdf";Integrated Security=True;Connect Timeout=30;User Instance=True"
providerName="System.Data.SqlClient" />


I have created the same database on the remote SQL 2005 server and now I need to modify the connection string to point to this database. I have gone to www.connectionstring.com but whilst there is a lot of information there, I am still unsure as to the connection string I should be using.

The database that I am trying to connect to has 2 instances:

MYSERVERNAME \ LIVESQLSERVER
MYSERVERNAME \ TESTSQLSERVER

My database RULESDB2 exists on the TESTSQLSERVER in C;\Program Files\ Microsoft SQL Server\MSSQL\DATA. I have a userId and password available. Can someone please tell me what the format of the connections string should be ?

thanks
Pat
Posted

I have used this type of connection string.. I hope have some idea how can write the Connection string.
C#
Data Source=Your system Name or You can used .[dot];Initial Catalog=Database Name;Integrated Security=True
// This type of connection string windows Authentication 


Sql Authentication
C#
<configuration>
 <connectionstrings>
  
   <add name="MyDbConn">
        connectionString="Server=MyServer; Database=pubs; User Id=MyUser; password= P@ssw0rd"
        providerName="System.Data.SqlClient" />
 </add></connectionstrings>
</configuration>


for more information check this link http://msdn.microsoft.com/en-us/library/ff648340.aspx[^]
 
Share this answer
 
v2
Comments
Maciej Los 21-Dec-13 16:47pm    
Looks well, 5!
you can try and check this one.


http://www.connectionstrings.com/[^]
 
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