title: How to fill DataTable with SQL Table
body: <p>I am currently creating and reading a DataTable with the following code in my Page_Load</p>
  
  <pre><code>protected void Page_Load(object sender, EventArgs e)
  {
      if (Session["AllFeatures1"] == null)
      {
          Session["AllFeatures1"] = GetData();
      }
      table = (DataTable)Session["AllFeatures1"];
      DayPilotCalendar1.DataSource = Session["AllFeatures1"];
      DayPilotNavigator1.DataSource = Session["AllFeatures1"];
  
      if (!IsPostBack)
      {
          DataBind();
          DayPilotCalendar1.UpdateWithMessage("Welcome!");
      }
  
      if (User.Identity.Name != "")
      {
          Panel1.Visible = true;
      }
  }
  </code></pre>
  
  <p>I would like to know how to convert this code so that it reads from a SQL query? I am experimenting with the code below but I'm not sure how to connect them so that datatable in my page load fills with the SQL command below.</p>
  
  <pre><code>SqlConnection conn = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["BarManConnectionString"].ConnectionString);
  conn.Open();
  string query = "SELECT * FROM [EventOne]";
  
  SqlCommand cmd = new SqlCommand(query, conn);
  
  DataTable t1 = new DataTable();
  using (SqlDataAdapter a = new SqlDataAdapter(cmd))
  {
      a.Fill(t1);
  }
  </code></pre>
  
  <p>I am stuck at:</p>
  
  <pre><code>table = (DataTable)Session["AllFeatures1"]; 
  </code></pre>
  
  <p>I would like it to be <code>t1 = (DataTable)Session["AllFeatures1];</code></p>