How to change sqlconnection string dynamically
change connection database or connect to sql server where i can access all databases avaliable
1 Answer
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
Ring ZhongRank #6,843 · 255 reputationPosted Sep 29, 2013, 6:13 PM EDT
Then retrieve it by using ConfigurationManager:
ConfigurationManager.ConnectionStrings["Target"].ConnectionString
EDIT:
You also need to reference the System.Configuration library in order to make it work.
A simple
textBox1.Text = ConfigurationManager.ConnectionStrings["Target"].ConnectionString;
Will show your connection string