title: How to add a column wise row value in data table from for loop
body: <p>How to add  a row in the data table</p>
  
  <p>Code</p>
  
  <pre><code>DataTable dt = new DataTable();
              dt.Clear();
              DataColumn dc = new DataColumn("day1", typeof(String));
              dt.Columns.Add(dc);
  
              dc = new DataColumn("day2", typeof(String));
              dt.Columns.Add(dc);
  
              dc = new DataColumn("day3", typeof(String));
              dt.Columns.Add(dc);
  
  tString[0] = "Sat,mon,tue";
  tString[1] = "Fri,,wed";
  tString[2] = "Thu,";
  
   int lengthA = tString.Length;
  
   for (int i = 0; i &lt;= lengthA - 1; i++)
              {
                  string s = tString[i];
  
                      string[] words = s.Split(',');
                      foreach (string word in words)
                      {
                              dt.Rows.Add(word);
                      }
  
                  }
  </code></pre>
  
  <p>The issue in dt.Rows.Add(word) because it is inserting a row </p>
  
  <p>Expected Output</p>
  
  <p>Datatable value should be</p>
  
  <pre><code>day1, day2, day3
  
  sun,mon,tue
  Fri,Wed
  Thu
  </code></pre>
  
  <p>Hot to achieve this, can any one help me</p>