Link to home
Start Free TrialLog in
Avatar of Chris Jones
Chris JonesFlag for United States of America

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of kaufmed
kaufmed
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial