Convert.ToInt32(cmd.ExecuteObject()) > 0 ? true : false

//判断会员是否存在
 public bool JudgeCardNoExist(string cardno)
{
 SqlSqlCommand cmd = new SqlSqlCommand();
 string sql="select count(*) from sanlian.mem_member where card_no='"+cardno+"' and card_type='1'";
 cmd.SqlText=sql;
 return Convert.ToInt32(cmd.ExecuteObject()) > 0  true : false;
}

   public object ExecuteObject()
{
 PrepareCommand();
      try{
 recordCmd.Connection.Open();
 return recordCmd.ExecuteScalar(); //返回第一行第一列}
      catch (Exception ex){  throw ex;}
      finally{recordCmd.Connection.Close();}
}
posted @ 2008-10-24 16:02  做你所想  阅读(238)  评论(0编辑  收藏  举报