string cResult = ""; try { cResult = dr["firstname"].ToString(); } catch (Exception) { // your exception code }