views:

40

answers:

2

I am using one database with the same name in SQL Server 2000 and SQL Server 2005.

How can I manage the connection string in the web.config file so that we can differentiate the connection.

While we are using the same user name and password for the both databases.

+1  A: 

They should have different server names, no?

[edit] As per the comments, if the server name is the same it would have a different instance name or port. You can only have one default instance, after all

Phil Nash
Or they could be the same server but seperate instances i.e.Server1 and Server1/Sql2kInstance
Sheff
Yes, instance name was really what I was looking for
Phil Nash
A: 

I would suggest that both install are running seperate instances if installed on the same server so just specify the instance name in your connection string.

so if one is the default Instance

Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword

;

and a non default instance example

Data Source=myServerAddress\OtherInstance;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;
Sheff