By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,130 Members | 727 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,130 IT Pros & Developers. It's quick & easy.

Regarding Connection string name when a user adds a dbml file

P: 20
Hi,
I am doing a sample VS 2008 project.

I have added a dbml file.On the designer,I have dragged a table "emp" from a database "Employee" which is in my server(for example Server1).
It created an app.config with connection string as
<connectionStrings>
<add name="LinQ2008.Properties.Settings.EmployeeConnectionString"
connectionString="Data Source=Server1;Initial Catalog=Employee;User ID=abc;Password=somepassword"
providerName="System.Data.SqlClient" />
</connectionStrings>
Next,I have added another dbml file.On the designer,I have dragged a table from a database "Employee" which is in a diffferent server(for example Server2).

Now in app.config the connection string is created as
<connectionStrings>
<add name="LinQ2008.Properties.Settings.EmployeeConnectionString1"
connectionString="Data Source=Server2;Initial Catalog=Employee;User ID=xyz;Password=somepassword"
providerName="System.Data.SqlClient" />
</connectionStrings>

My doubt is
(1) When two datasources/servers having same database name(for example Employee) are there,then if we drag a table from Employee database from "Server1", a connection string is created as "EmployeeConnectionString" in app.config.
If we drag a table from Student database from "Server2", another connection string is created as "EmployeeConnectionString1" in app.config.

How to have a common connectionstring name instead creating different connection strings.

Thanks,
Silpa
Mar 13 '08 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.