Ejemplo n.º 1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(DSJL.Model.TB_Setting model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update TB_Setting set ");
            strSql.Append("SetName=OLEDBSetName,");
            strSql.Append("SetValue=OLEDBSetValue");
            strSql.Append(" where ID=OLEDBID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("OLEDBSetName",  OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBSetValue", OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBID",       OleDbType.Integer, 4)
            };
            parameters[0].Value = model.SetName;
            parameters[1].Value = model.SetValue;
            parameters[2].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public DSJL.Model.TB_Setting GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,SetName,SetValue from TB_Setting ");
            strSql.Append(" where ID=OLEDBID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("OLEDBID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["ID"].ToString() != "")
                {
                    model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.SetName  = ds.Tables[0].Rows[0]["SetName"].ToString();
                model.SetValue = ds.Tables[0].Rows[0]["SetValue"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(DSJL.Model.TB_Setting model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_Setting(");
            strSql.Append("SetName,SetValue)");
            strSql.Append(" values (");
            strSql.Append("OLEDBSetName,OLEDBSetValue)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("OLEDBSetName",  OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBSetValue", OleDbType.VarChar, 255)
            };
            parameters[0].Value = model.SetName;
            parameters[1].Value = model.SetValue;

            DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public DSJL.Model.TB_Setting GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,SetName,SetValue from TB_Setting ");
            strSql.Append(" where ID=OLEDBID");
            OleDbParameter[] parameters = {
                    new OleDbParameter("OLEDBID", OleDbType.Integer,4)
            };
            parameters[0].Value = ID;

            DSJL.Model.TB_Setting model=new DSJL.Model.TB_Setting();
            DataSet ds=DbHelperOleDb.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                if(ds.Tables[0].Rows[0]["ID"].ToString()!="")
                {
                    model.ID=int.Parse(ds.Tables[0].Rows[0]["ID"].ToString());
                }
                model.SetName=ds.Tables[0].Rows[0]["SetName"].ToString();
                model.SetValue=ds.Tables[0].Rows[0]["SetValue"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }