/// <summary>
        /// 是否存在该记录
        /// </summary>
        public bool Exists(string QT_NO, string PRD_NO)
        {
            StringBuilder strSql = new StringBuilder();
            strSql.Append("select count(1)  as gets from   OP_QT_ITM_TempOrderBy  ");
            strSql.Append(" where QT_NO=@QT_NO and PRD_NO=@PRD_NO ");

            SqlParameter[] parameters = {
                    new SqlParameter("@QT_NO", SqlDbType.VarChar,50),
                    new SqlParameter("@PRD_NO", SqlDbType.VarChar,50)};
            parameters[0].Value = QT_NO;
            parameters[1].Value = PRD_NO;

            DataSet ds = DbHelperSQL.Query(strSql.ToString(), parameters);



            if (ds.Tables[0].Rows.Count > 0)
            {

                if (int.Parse(ds.Tables[0].Rows[0]["gets"].ToString()) > 0)
                {
                    return true;
                }

                else
                {

                    return false;
                }
                
                
            }
            else
            {
                return false;

            }
        }


附上原来的代码,晕死了!这个应该不会错才是

  /// <summary>
    /// 是否存在该记录
    /// </summary>
    public bool Exists(string QT_NO,string PRD_NO)
    {
      StringBuilder strSql=new StringBuilder();
      strSql.Append("select count(1) from OP_QT_ITM_TempOrderBy");
      strSql.Append(" where QT_NO=@QT_NO and PRD_NO=@PRD_NO ");

      SqlParameter[] parameters = {
          new SqlParameter("@QT_NO", SqlDbType.VarChar,50),
          new SqlParameter("@PRD_NO", SqlDbType.VarChar,50)};
      parameters[0].Value = QT_NO;
      parameters[1].Value = PRD_NO;

      return DbHelperSQL.Exists(strSql.ToString(),parameters);
    }
Tags:
Pages: 1/1 First page 1 Final page [ View by Articles | List ]