title: Datalist control : binding with ADO.NET objects
body: <p>Here's the code:</p>
  
  <pre><code>private void ShowPossiblePurchases(string CategoryName)
  {
  
      string selectSQL = "SELECT TOP 2 * FROM Menu WHERE CategoryName=@CategoryName ORDER BY NEWID()";
      SqlCommand cmd = new SqlCommand(selectSQL, connection);
      cmd.Parameters.AddWithValue("@CategoryName", CategoryName);
      SqlDataReader reader;
  
      DataSet myDataSet = new DataSet();
      myDataSet.Tables.Add("Products");
  
  
      myDataSet.Tables["Products"].Columns.Add("ProductID");
      myDataSet.Tables["Products"].Columns.Add("CategoryID");
      myDataSet.Tables["Products"].Columns.Add("ProductName");
      myDataSet.Tables["Products"].Columns.Add("Price");
  
      DataList DataList1 = (DataList)lgnView.FindControl("DataList1");
  
      try
      {
          connection.Open();
          reader = cmd.ExecuteReader();
  
          while (reader.Read())
          {
  
              DataRow rowNew = myDataSet.Tables["Products"].NewRow();
              rowNew["ProductID"] = reader["ProductID"];
              rowNew["CategoryID"] = reader["CategoryID"];
              rowNew["ProductName"] = reader["ProductName"];
              rowNew["Price"] = reader["Price"];
              myDataSet.Tables["Products"].Rows.Add(rowNew);
          }
  
          DataList1.DataSource = myDataSet.Tables["Products"];
          DataList1.DataBind();
      }
      catch(Exception ex)
      {
          Label lblError = (Label)lgnView.FindControl("lblError");
          lblError.Text = ex.Message;
      }
      finally
      {
          connection.Close();
      }
  }
  </code></pre>
  
  <p>When i run it, nothing happens. What am i doing wrong?</p>