How can open two sql connectionString in online project
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Manish Kumar ChoudharyRank #339 · 7.4K reputationPosted Nov 17, 2014, 9:08 PM EST
Create two Separate connection object and use both connection string separately.
public class Configuration
{
internal static string CS1 = ConfigurationManager.ConnectionStrings["CS1"].ConnectionString;
internal static string CS2 = ConfigurationManager.ConnectionStrings["CS2"].ConnectionString;
}
And now use this connection string as
//Used for First connection string
using (SqlConnection con = new SqlConnection(Configuration. CS1))
{
//code that use First connection string
}
//Used for second connection string
using (SqlConnection con = new SqlConnection(Configuration. CS2))
{
//code that use second connection string
}
Najim MullaRank #2,088 · 689 reputationPosted Nov 18, 2014, 8:16 PM EST
sir this 3 string connection how can open at a time 2 connection string in web confing page