sessions and c# error

Hello,

i have a strange error i am trying to setup a look to create sessions on teh fly from my dayabase but i get an error stateing that i cant use session like a method.

CODE
        public void Get_System_Sertup()
        {
            SqlCommand sql = new SqlCommand();
            SqlConnection conn = default(SqlConnection);
            Connect ORC = new Connect();
            SqlDataReader dr = default(SqlDataReader);
      
            ///''''''''''''''''''''''''''''''''''''''''''''
            // set some ghost variables for the system setup 
            string Value = "";
            string SystemValue = "";
            ///''''''''''''''''''''''''''''''''''''''''''''

            // *****
            // ***** Connect to database
            // *****
            conn = ORC.NewSQLConnectionWebAppT();
            sql.Connection = conn;

            // setup the sql action to insert update or delete using parameterized data
            sql.Parameters.AddWithValue("@VALUE", "Y");

            // *****
            // ***** Get system data from server
            // *****
            sql.CommandText = "SELECT System,SystemValue FROM " + dbPrefix + "_System_Settings WHERE Valid = '@VALUE'";
            dr = sql.ExecuteReader();



            ///''''''
            // gets The values form the database to display to The user
            ///'''''
            while (dr.Read())
            {
                Value = Convert.ToString(dr["System"]);
                SystemValue = Convert.ToString(dr["SystemValue"]);
                HttpContext.Current.Session(Convert.ToString(Value)) = SystemValue;
                // sets sessions on the fly
            }


            // *****
            // ***** Close Database
            // *****
            dr.Close();
            sql.Dispose();
            conn.Close();

        }

Open in new window



ERROR
Error	2	Non-invocable member 'System.Web.HttpContext.Session' cannot be used like a method.	I:\Synamics\Synamics\SystemInternals.cs	60	37	Synamics

Open in new window

LVL 1
Chris JonesLead Application Web DeveloperAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
Don't use parentheses when indexing the Session object--use brackets:

HttpContext.Current.Session[Convert.ToString(Value)] = SystemValue;

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
C#

From novice to tech pro — start learning today.