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

            strSql.Append("update TB_Dict set ");
            strSql.Append("Dict_GroupID=OLEDBDict_GroupID,");
            strSql.Append("Dict_Value=OLEDBDict_Value,");
            strSql.Append("Dict_Key=OLEDBDict_Key,");
            strSql.Append("actionone=OLEDBactionone,");
            strSql.Append("actiontwo=OLEDBactiontwo");
            strSql.Append(" where ID=OLEDBID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("OLEDBDict_GroupID", OleDbType.Integer,   4),
                new OleDbParameter("OLEDBDict_Value",   OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBDict_Key",     OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBactionone",    OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBactiontwo",    OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBID",           OleDbType.Integer, 4)
            };
            parameters[0].Value = model.Dict_GroupID;
            parameters[1].Value = model.Dict_Value;
            parameters[2].Value = model.Dict_Key;
            parameters[3].Value = model.actionone;
            parameters[4].Value = model.actiontwo;
            parameters[5].Value = model.ID;

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

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

            strSql.Append("select ID,Dict_GroupID,Dict_GroupID2,Dict_Value,Dict_Key,actionone,actiontwo from TB_Dict ");
            strSql.Append(" where ID=OLEDBID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("OLEDBID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

            DSJL.Model.TB_Dict model = new DSJL.Model.TB_Dict();
            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());
                }
                if (ds.Tables[0].Rows[0]["Dict_GroupID"].ToString() != "")
                {
                    model.Dict_GroupID = int.Parse(ds.Tables[0].Rows[0]["Dict_GroupID"].ToString());
                }
                model.Dict_GroupID2 = ds.Tables[0].Rows[0]["Dict_GroupID2"].ToString();
                model.Dict_Value    = ds.Tables[0].Rows[0]["Dict_Value"].ToString();
                model.Dict_Key      = ds.Tables[0].Rows[0]["Dict_Key"].ToString();
                model.actionone     = ds.Tables[0].Rows[0]["actionone"].ToString();
                model.actiontwo     = ds.Tables[0].Rows[0]["actiontwo"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(DSJL.Model.TB_Dict model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into TB_Dict(");
            strSql.Append("Dict_GroupID,Dict_Value,Dict_Key,actionone,actiontwo)");
            strSql.Append(" values (");
            strSql.Append("OLEDBDict_GroupID,OLEDBDict_Value,OLEDBDict_Key,OLEDBactionone,OLEDBactiontwo)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("OLEDBDict_GroupID", OleDbType.Integer,   4),
                new OleDbParameter("OLEDBDict_Value",   OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBDict_Key",     OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBactionone",    OleDbType.VarChar, 255),
                new OleDbParameter("OLEDBactiontwo",    OleDbType.VarChar, 255)
            };
            parameters[0].Value = model.Dict_GroupID;
            parameters[1].Value = model.Dict_Value;
            parameters[2].Value = model.Dict_Key;
            parameters[3].Value = model.actionone;
            parameters[4].Value = model.actiontwo;

            DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);
        }
Esempio n. 4
0
        /// <summary>
        /// �õ�һ������ʵ��
        /// </summary>
        public DSJL.Model.TB_Dict GetModel(int ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,Dict_GroupID,Dict_GroupID2,Dict_Value,Dict_Key,actionone,actiontwo from TB_Dict ");
            strSql.Append(" where ID=OLEDBID");
            OleDbParameter[] parameters = {
                    new OleDbParameter("OLEDBID", OleDbType.Integer,4)
            };
            parameters[0].Value = ID;

            DSJL.Model.TB_Dict model=new DSJL.Model.TB_Dict();
            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());
                }
                if(ds.Tables[0].Rows[0]["Dict_GroupID"].ToString()!="")
                {
                    model.Dict_GroupID=int.Parse(ds.Tables[0].Rows[0]["Dict_GroupID"].ToString());
                }
                model.Dict_GroupID2 = ds.Tables[0].Rows[0]["Dict_GroupID2"].ToString();
                model.Dict_Value=ds.Tables[0].Rows[0]["Dict_Value"].ToString();
                model.Dict_Key=ds.Tables[0].Rows[0]["Dict_Key"].ToString();
                model.actionone=ds.Tables[0].Rows[0]["actionone"].ToString();
                model.actiontwo=ds.Tables[0].Rows[0]["actiontwo"].ToString();
                return model;
            }
            else
            {
                return null;
            }
        }