title: How to create a DataTable and filling it with a data from the database using the DataView?
body: <p>I am a new ASP.NET developer and I want to create a table programmatically using <code>HtmlTable</code> or <code>DataTable</code> and then filling this table with the data from the database using <code>DataView</code>. </p>
  
  <p>I could be able to create a table using <code>HtmlTable</code> but when I did a search regarding "how to fill <code>HtmlTable</code> with a data using <code>DataView</code>", I found that DataView will not work with <code>HtmlTable</code>. So I repeated creating the table using the <code>DataTable</code>, but now I need to fill it with the data using <code>DataView</code>, so how can I do that?</p>
  
  <p>My code: </p>
  
  <pre><code>    DataTable table = new DataTable();
  
      DataColumn col1 = new DataColumn("Name");
      DataColumn col2 = new DataColumn("Username");
  
      col1.DataType = System.Type.GetType("System.String");
      col2.DataType = System.Type.GetType("System.String");
  
      table.Columns.Add(col1);
      table.Columns.Add(col2);
  
      DataRow row = table.NewRow();
      row[col1] = "John";
      row[col2] = "John123";
      table.Rows.Add(row);
  
  
      GridView gv = new GridView();
      gv.DataSource = table;
      gv.DataBind();
  </code></pre>
  
  <p>Regarding the table in the database, the schema of the User Table is:</p>
  
  <pre><code>Username, FirstName, LastName, Age, Job
  </code></pre>