title: How to return data from the database using 3 tier architecture structure using ASP.NET C#
body: <p>Let's say I have a 3-tier ASP.NET application written in C#. How are you supposed to utilize the DAL, BLL and PL correctly?</p>
  
  <p>For example let's say I have a stored procedure which requires a parameter of customer ID to be passed in before it returns results. In my data access layer I could have the following:</p>
  
  <pre><code>public DataTable GetCustomerInfo(collection b)
  {
      DataTable table;
  
      try
      {
          string returnValue = string.Empty;
          DB = Connect();
          DBCommand = connection.Procedure("sp_getCust");
          DB.AddInParameter(DBCommand, "@CustomerID", DbType.String, b.CustomerID);
  
          DbDataReader reader = DBCommand.ExecuteReader();
          table = new DataTable();
          table.Load(reader);
          return table;
      }
      catch (Exception ex)
      {
          throw (ex);
      }
  }
  </code></pre>
  
  <p>Then in my <strong>BLL</strong>, I would then get that returned table and populate a dataset?</p>
  
  <p>I have tried to populate a dataset without my <code>DataTable</code> called, "table"</p>
  
  <pre><code>public static DataTable returnCustomer(collection b)
  {
      try
      {
             SqlDataAdapter adapt = new SqlDataAdapter();
             DataSet table = new DataSet();
  
             adapt.Fill(table, "table");
             return table;
      }
      catch (Exception ex)
      {
          throw ex;
      }
  }
  </code></pre>
  
  <p>However I get these error:</p>
  
  <p><img src="https://i.stack.imgur.com/rqaAh.png" alt="Error returning datatable to dataset."></p>
  
  <p>Also: how to bind the dataset so that I can return the data to my textboxes?</p>