title: how to check every value in row of datatable using c#
body: <p>I  have two tables called <code>visits</code> and <code>members</code>  and i am getting the data by using following query..</p>
  
  <pre><code> string sql=  @"SELECT member_Firstname, member_Lastname, member_Postcode,  
            visit_DateTime, visit_Status, visit_Logout_DateTime, visits.member_Id, visit_AlertMsg
            FROM members, visits
            WHERE members.member_Id = visits.member_Id
            AND members.member_Active LIKE 'y%'";
  </code></pre>
  
  <p>at here i am getting  the visit_DateTime values with by using some comparisons with combobox values </p>
  
  <pre><code>    datatable dt = helper.getdata(sql)
       foreach (DataRow row in dt.Rows)
       {
           if (row["visit_Logout_DateTime"] != null)
           {
            DateTime dtlogout = DateTime.Parse(row["visit_Logout_DateTime"].ToString());
            if (dtlogout != null)
            {
              if (cbPeriod.Text == "Today")
              {
                newItem.lblTime.Text = dtlogout.ToString("HH':'mm':'ss");
  
              }
              else
                newItem.lblTime.Text = dtlogout.ToString("yyyy'-'MM'-'dd'  -  'HH':'mm':'ss");
            }
          }
  
       }
  </code></pre>
  
  <p>but i got the error at this line <code>DateTime dtlogout = DateTime.Parse(row["visit_Logout_DateTime"].ToString());</code></p>
  
  <p><strong>error :</strong> <code>string was not recognised as valid datetime (because of one value in that row is empty)</code></p>
  
  <p>the row <code>"visit_Logout_DateTime"</code> </p>
  
  <p>i have got the values of  <code>"visit_Logout_DateTime"</code> like this....</p>
  
  <pre><code>firstname     lastname   postcode      visit_Logout_DateTime
  -------------  --------   ---------      ---------------------
   rob            peter     hhd344h            
   peter         chan        hy78kjk         2011-09-08 12:09:08
   rock          sam        yudufg3746h      2011-08-08 09:08:45
  </code></pre>
  
  <p>i have tried that for checking the empty values of this  visit_Logout_DateTime like i mentioned above..</p>
  
  <p>but i have failed for chacking ever value is empty or not in that row...</p>
  
  <p>how to check every value in this row  (row["visit_Logout_DateTime"]) is empty or not </p>
  
  <p>would any one pls help me  on this guys ... </p>
  
  <p>many thanks.... </p>