I have a form that has a few labels that display data from a SQL database. It uses a stored procedure to return one line of data. As part of the returned dataset, a label_color is also returned. I want to be able to set a certain label to this color. The returned format is Hex value ('#006600'-- for Green etc)
You will see in the if statement.. I have a lbl1latest1.ForeColor = Color.Red .. Instead I want to set it to what SQL returns.. can some one help me out please?
            myDbconnection.Open();
            string sqlQRY1 = "exec [sp_get_standpack_values]  1";
            SqlCommand cmd1 = new SqlCommand(sqlQRY1, myDbconnection);
            SqlDataReader reader1 = cmd1.ExecuteReader();
            reader1.Read();
            if (reader1.HasRows)
            {
                lblStandpack1.Text = reader1["standpack"].ToString();
                lbltarget1.Text = reader1["cl_rating"].ToString();
                lbllatest1.Text = reader1["XRayCL"].ToString();
                string colorcode = reader1["label_color"].ToString();
                int argb = Int32.Parse(colorcode.Replace("#", ""), NumberStyles.HexNumber);
                Color clr = Color.FromArgb(argb);
                lbllatest1.ForeColor = clr;
            }
            else
            {
                lblStandpack1.Text = "";
                lbltarget1.Text = "";
                lbllatest1.Text = "";
                lbllast10avg1.Text = "";
                lbltodayavg1.Text = "";
            }
            myDbconnection.Close();
