Beispiel #1
0
        /// <summary>
        /// 查询总条数
        /// </summary>
        /// <param name="name"></param>
        /// <param name="statu"></param>
        /// <returns></returns>
        public int pageIndex(string name, int statu, int loantype, string loanstitles)
        {
            int    num = 0;
            string sdt = "and 1=1";

            if (loanstitles != "")
            {
                sdt += " and NTitle like '" + loanstitles + "%'";
            }
            if (loantype != -1)
            {
                sdt += " and TypeID=" + loantype + "";
            }
            string sql = "select Count(Newsid) from NewsTab where  audit=@statu " + sdt + " and UserName=@name";

            SqlParameter[] para =
            {
                new SqlParameter("@name",  SqlDbType.VarChar, 50),
                new SqlParameter("@statu", SqlDbType.Int, 4)
            };
            para[0].Value = name;
            para[1].Value = statu;
            num           = Convert.ToInt32(DBHelpe.GetSingle(sql, para));
            return(num);
        }
Beispiel #2
0
        /// <summary>
        /// 增加错误处理的一条数据
        /// </summary>
        public int Add(ErrowTab model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ErrowTab(");
            strSql.Append("LoginName,LinkURL,QuestionDescript,Connetions,BoolChuLi,BoolReturn,ReturnContext,Descript,createtime,updatetime)");
            strSql.Append(" values (");
            strSql.Append("@LoginName,@LinkURL,@QuestionDescript,@Connetions,@BoolChuLi,@BoolReturn,@ReturnContext,@Descript,@createtime,@updatetime)");
            strSql.Append(";select @@IDENTITY");
            SqlParameter[] parameters =
            {
                new SqlParameter("@LoginName",        SqlDbType.NVarChar,  300),
                new SqlParameter("@LinkURL",          SqlDbType.NVarChar,  300),
                new SqlParameter("@QuestionDescript", SqlDbType.Text),
                new SqlParameter("@Connetions",       SqlDbType.NVarChar,  300),
                new SqlParameter("@BoolChuLi",        SqlDbType.Int,         4),
                new SqlParameter("@BoolReturn",       SqlDbType.Int,         4),
                new SqlParameter("@ReturnContext",    SqlDbType.Text),
                new SqlParameter("@Descript",         SqlDbType.NVarChar,  500),
                new SqlParameter("@createtime",       SqlDbType.DateTime),
                new SqlParameter("@updatetime",       SqlDbType.DateTime)
            };
            parameters[0].Value = model.LoginName;
            parameters[1].Value = model.LinkURL;
            parameters[2].Value = model.QuestionDescript;
            parameters[3].Value = model.Connetions;
            parameters[4].Value = model.BoolChuLi;
            parameters[5].Value = model.BoolReturn;
            parameters[6].Value = model.ReturnContext;
            parameters[7].Value = model.Descript;
            parameters[8].Value = model.createtime;
            parameters[9].Value = model.updatetime;

            object obj = DBHelpe.GetSingle(strSql.ToString(), parameters);

            if (obj == null)
            {
                return(0);
            }
            else
            {
                return(Convert.ToInt32(obj));
            }
        }