I don't know whether I follow you here or not, but,
con = new SqlConnection(string.Format("server=.;database={0};", dbToUse));
string yourConnection = ConfigurationManager.ConnectionStrings["Entities"].ConnectionString.Replace("dbname", dbToUse[0].Location);
con = new SqlConnection(yourConnection);
Change your code to this,
SqlConnection con = null;
var dbToUse = objser.Getip((ddcmpname.SelectedValue).ToString()).ToList();
string yourConnection = ConfigurationManager.ConnectionStrings["Entities"].ConnectionString.Replace("dbname", dbToUse[0].Location);
con = new SqlConnection(yourConnection);
con.open();
The reason I remove the previous statement was, that it does not make any difference. You are not opening the connection for that object type, you are however making a connection here. With this code, you just need to make sure your path is correct.
If the path is incorrect, we are unable to help because we do not know your networks settings and configurations. In this case,
SQL Server connection strings - ConnectionStrings.com[
^], would be able to help you out.