title: Retrieving a DateTime value from a DataRow (C#)
body: <p>How can I get <code>DateTime</code> value in C# from row, the current code is giving me error
  any help is appreciated, the data is coming in from progress database:</p>
  
  <pre><code>foreach (DataRow r in ds.Tables[0].Rows)
  {
      string prodCode = r["PRD-CDE"].ToString();
      statCode = r["STAT"].ToString();
      DateTime firstIssueDate = (DateTime)(r["FISS"]); 
      DateTime endIssueDate = (DateTime)(r["EISS"]);
      if(endIssueDate &gt; DateTime.Now)
      { /*do some thing...*/}
      else {/*user invalid...*/}
  }
  </code></pre>
  
  <p>there are two ways used in getting date convert and pars, thank you all for the help</p>
  
  <p><strong>Final working Code snippet:</strong> </p>
  
  <pre><code>foreach (DataRow r in ds.Tables[0].Rows)
              {
                  string prodCode = r["PRD-CDE"].ToString(),statCode = r["STAT"].ToString();
                 // r.&lt;DateTime?&gt;("FISS");
                  if (r["FISS"] != DBNull.Value)
                  {
                      DateTime firstIssueDate = Convert.ToDateTime(r["FISS"]);
                      if (r["EISS"] != DBNull.Value)
                      {
                          DateTime endIssueDate = DateTime.Parse(r["EISS"].ToString());
                          if (endIssueDate &gt; DateTime.Now)
                          {
  </code></pre>