estoy desarrollando mi primer Programm y estoy frente a algunos problemas por favor, ayúdame a completarlo tengo este código en C#:No se puede convertir implícitamente el tipo 'objeto' a 'System.DateTime'. existe una conversión explícita (¿falta un yeso?)
SqlDataReader dr = null;
dr = cmd.ExecuteReader();
if (dr.Read())
{
client_id = dr["clientid"].ToString();
surname = dr["surname"].ToString();
othername = dr["othername"].ToString();
gender = dr["gender"].ToString();
date_ofbirth = dr["dateofbirth"];
nationality = dr["nationality"].ToString();
//age = dr["Age"];
residential_address = dr["residentialaddress"].ToString();
postal_address = dr["postaladdress"].ToString();
contact_number = dr["telephonenumber"].ToString();
marital_status = dr["maritalstatus"].ToString();
spouse_name = dr["spousename"].ToString();
email = dr["email"].ToString();
occupation = dr["occupation"].ToString();
typeof_id = dr["typeofid"].ToString();
id_number = dr["idnumber"].ToString();
id_expirydate = dr["idexpirydate"];
remarks = dr["remarks"].ToString();
picture = dr["picture"].ToString();
return true;
cmd.CommandText = null;
}
y el mensaje de error para esto es ............... date_ofbirth = dr ["dateofbirth"];
Error 2 No se puede convertir implícitamente el tipo 'objeto' a 'System.DateTime'. existe una conversión explícita
(¿falta un yeso?)
C: \ Users \ MICKY \ documentos \ Visual Studio 2008 \ Projects \ Godswill \ Godswill \ Personal.cs 249 28 Godswill
Poco Gotcha que pasé 15 minutos en: apuesto lanzará el mismo error si la clase no es pública, pero en lugar privado. Un poco oscuro. –