title: How to display lucky draw result on a table
body: <p>Currently I'm working on lucky draw system. My system are functioning well but I just want to add one features that is it can display a lucky draw result on a table in another page at the same time. Previously, when user click on button draw at the system, it will display out the result at the page. So, how to make the result display on table in another page at the same time when user click button draw?</p>
  
  <p>This is my lucky draw code :</p>
  
  <pre><code>using System;  
  using System.Collections.Generic;  
  using System.Configuration;  
  using System.Data;  
  using System.Data.SqlClient;  
  using System.IO;  
  using System.Linq;  
  using System.Web;  
  using System.Web.UI;  
  using System.Web.UI.WebControls;  
  
  public partial class _Default : System.Web.UI.Page        
  {  
      string constr = ConfigurationManager.ConnectionStrings["lucky"].ConnectionString;  
      protected void Page_Load(object sender, EventArgs e)  
      {  
  
      }  
      static List&lt;string&gt; list = new List&lt;string&gt;();  
      protected void Button1_Click(object sender, EventArgs e)  
      {  
          string query = "SELECT TOP 1[Emp_id]FROM Emp_Info WHERE[Attendance] = 'Present'ORDER BY NEWID()";  
          using (SqlConnection con = new SqlConnection(constr))  
          {  
              using (SqlCommand cmd = new SqlCommand(query))  
              {  
                  using (SqlDataAdapter sda = new SqlDataAdapter())  
                  {  
                      cmd.Connection = con;  
                      sda.SelectCommand = cmd;  
                      using (DataTable dt = new DataTable())  
                      {  
                          sda.Fill(dt);  
                          if (dt.Rows.Count &gt; 0)  
                          {        
                              if (list.Any(x =&gt; x.Equals(dt.Rows[0]["Emp_id"].ToString())))  
                              {                 
                                  //Label1.Text += "is duplicate";  
                              }  
                              else  
                              {  
                                  list.Add(dt.Rows[0]["Emp_id"].ToString());  
                                  Label1.Text = dt.Rows[0]["Emp_id"].ToString();  
                              }              
                          }  
                          else  
                          {  
                              Label1.Text += "Cannot draw! ";  
                          }  
                      }  
                  }  
              }  
          }  
      }  
  } 
  </code></pre>