In the following code, when i want to write the result i face the Null
issue. If the fiels read is null then it throws an exception.
The way i deal with it is by placing a if test.... Is there a better
way ?
Thanks

foreach (Row  row in rows)
           {
               IFormatProvider culture = new CultureInfo("fr-FR",
true);
               .Entities.Contact d = new Entities.Contact );


                  d.id = Guid.Parse(row["id_c"].ToString());
                  d.salutation = row["salutation"].ToString();
                  d.first_name=   row["first_name"].ToString();
                  d.last_name= row["last_name"].ToString();
                  if (row["birthdate"] != null)
                      d.birthdate =
DateTime.Parse(row["birthdate"].ToString(), culture,
DateTimeStyles.None);

                  if (row["phone_home"] != null)
                        d.phone_home=  row["phone_home"].ToString();
                  if (row["phone_work"] != null)
                        d.phone_work = row["phone_work"].ToString();

                  dataAccess.Save(d);
           }

-- 
You received this message because you are subscribed to the Google Groups 
"Rhino Tools Dev" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rhino-tools-dev?hl=en.

Reply via email to