0

HIho

i have tried all of these to read from the settings list in my program but no of them reads from it.. i think i need to some help with it please :)

//hostBox.Text = ConfigurationManager.AppSettings["Setting"].ToString();                //= ERROR
            //hostBox.Text = ConfigurationManager.AppSettings["Setting"].Get();                     //= ERROR
            //hostBox.Text = ConfigurationSettings.AppSettings["Setting"].ToString();               //= ERROR
            //hostBox.Text = ConfigurationManager.AppSettings.Get("Setting");                       //= NO RESULT
            //hostBox.Text = System.Configuration.ConfigurationSettings.AppSettings["Setting"];     //= NO RESULT
            //userBox.Text = ConfigurationManager.AppSettings["username"]; 

            Configuration config = ConfigurationManager.OpenExeConfiguration(Application.ExecutablePath); 
            ConnectionStringSettings connstr = config.ConnectionStrings.ConnectionStrings["username"]; 
            String strConn = connstr.ConnectionString;
            userBox.Text = strConn;

Im just lookin for a simple line that read and prints out my username setting (that i have added by hand)

1
Contributor
1
Reply
2
Views
9 Years
Discussion Span
Last Post by njitram
0

anny one know how to fetch data from the settings?

INSERT?
DELETE?
UPDATE?

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.