title: how to add rows in datatable in for loop from a sql table
body: <p>I have a problem with my c# code in a asp.net website.</p>
  
  <p>Here is my code.</p>
  
  <pre><code>mood = Session["feeling"].ToString();
  DataTable dt2 = blrate.selectmood("selectmood", mood);
  DataTable dt3=new DataTable();
  
  for (int k = 0; k &lt; dt2.Rows.Count; k++)
  {
      dt3.Rows[k][0]= music.selectMusic("sel_musicname", Convert.toInt32(dt2.Rows[k][2]));
      dt3.Rows[k][1] = music.selectMusic("sel_musicUrl", Convert.ToInt32(dt2.Rows[k][2]));
  }
  GridView1.DataSource = dt3;
  GridView1.DataBind(); 
  </code></pre>
  
  <p>I want to add rows in datatable but it has the eror </p>
  
  <blockquote>
    <p>There is no row in position 0.</p>
  </blockquote>
  
  <p>Final datatable must have two columns and k rows.<br>
  what should i do???   </p>