Ejemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Session["success"] != null && (Boolean)Session["success"] == true)
            {
                Response.Write("success!");
                Session["success"] = false;
            }

            //Read Database to display numbers

            //Connect to database
            string        connStr = ConfigurationManager.ConnectionStrings["GUCera"].ConnectionString;
            SqlConnection conn    = new SqlConnection(connStr);

            //Query current ID
            conn.Open();
            int        current = (int)Session["user"];
            string     sql     = "SELECT mobileNumber from UserMobileNumber where id=@current";
            SqlCommand cmd     = new SqlCommand(sql, conn);

            cmd.Parameters.AddWithValue("@current", current);
            SqlDataReader reader = cmd.ExecuteReader();


            //Display the Data
            Phones.DataSource = reader;
            Phones.DataBind();
            conn.Close();
        }