Пример #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(cycms.Model.DownLoadType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update dbo_DownLoadType set ");
            strSql.Append("dbo_TypeName=@dbo_TypeName");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@dbo_TypeName", OleDbType.VarChar, 100),
                new OleDbParameter("@ID",           OleDbType.Integer, 4)
            };
            parameters[0].Value = model.dbo_TypeName;
            parameters[1].Value = model.ID;

            int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(cycms.Model.DownLoadType model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into dbo_DownLoadType(");
            strSql.Append("dbo_TypeName)");
            strSql.Append(" values (");
            strSql.Append("@dbo_TypeName)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@dbo_TypeName", OleDbType.VarChar, 100)
            };
            parameters[0].Value = model.dbo_TypeName;

            int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public cycms.Model.DownLoadType DataRowToModel(DataRow row)
 {
     cycms.Model.DownLoadType model = new cycms.Model.DownLoadType();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["dbo_TypeName"] != null)
         {
             model.dbo_TypeName = row["dbo_TypeName"].ToString();
         }
     }
     return(model);
 }
Пример #4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public cycms.Model.DownLoadType GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,dbo_TypeName from dbo_DownLoadType ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

            cycms.Model.DownLoadType model = new cycms.Model.DownLoadType();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }