In my application I implement a dynamic connection string that get values directly from the app.config file. But before get values I assigned values to label text and the call it from connection string. I want to get that value directly from string without using label
This is my code
dbserverip.Text = ConfigurationManager.AppSettings["serverip"].ToLower().Trim();
curport.Text = ConfigurationManager.AppSettings["dbport"].ToLower().Trim();
currentdb.Text = ConfigurationManager.AppSettings["defdatabase"].ToLower().Trim();
after I assigned values to labels, I called it from connection string like this:
string constring = string.Format(
"datasource='{0}';port='{1}';database='{2}';username=uwloanmanmain;password=XXXXXXXX;Connect Timeout=180;Command Timeout=180",
dbserverip.Text, curport.Text, currentdb.Text);
but I want to do this without using any labels. Just only using string values. How can I do this?
Sessionobjects or you could store these in apublic static string dbserverip { get; set; };for example.. look up how to declare and usestring variablesas well MSDN C# Strings