title: Input string was not in a correct format.Couldn't store <> in Column. Expected Int64
body: <p>here i am trying to get the comma separated values. In the following code "tbl"
  is the table which contains the comma separated values..</p>
  
  <pre><code> private static DataTable PivotFieldData(DataTable tbl)
      {
          var tblPivot = new DataTable();
          if (tbl.Columns.Count &gt; 0)
          {
              tblPivot.Columns.Add(tbl.Columns[0].ColumnName, typeof(int));
              for (int i = 0; i &lt; tbl.Rows.Count; i++)
              {
                  tblPivot.Columns.Add(Convert.ToString(tbl.Rows[i][1]), typeof(long));
              }
              var r = tblPivot.NewRow();
              r[0] = tbl.Rows[0][0].ToString();
              for (int col = 0; col &lt; tbl.Rows.Count; col++)
              {
                  r[col + 1] = tbl.Rows[col][2].ToString();
              }
              tblPivot.Rows.Add(r);
          }
          return tblPivot;
      }
  </code></pre>
  
  <p>but i am getting an error as follow.</p>
  
  <p><a href="https://i.stack.imgur.com/AbI4y.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/AbI4y.png" alt="this is the error displayed when i am displaying the table values in a gridview format as "></a></p>
  
  <p>i have tried like </p>
  
  <pre><code>r[col + 1] = tbl.Rows[col][2].ToString().Trim() == "" ? 0 : Convert.ToInt64(tbl.Rows[col][2].ToString());
  </code></pre>
  
  <p>but i am getting an error that input string was not in correct format ....
  please check it and help me... thank you..</p>