I'm seeing this code:
object objvalid = cmd.ExecuteScalar();
//made it this far - must not have thrown an exception
retVal = true;
...but am thinking one of these might be better:
object objvalid = cmd.ExecuteScalar();
retVal = (null != objvalid);
...
Int32 anybodyThere = (Int32) cmd.ExecuteScalar();
retVal = anybodyThere > 0;
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…