示例#1
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(Maticsoft.Model.s5ShuJuCunZhu model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into s5ShuJuCunZhu(");
            strSql.Append("sBianHao,sCT,sCiGongZheng,sBingLi,iUserID)");
            strSql.Append(" values (");
            strSql.Append("@sBianHao,@sCT,@sCiGongZheng,@sBingLi,@iUserID)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@sBianHao",     OleDbType.VarChar, 255),
                new OleDbParameter("@sCT",          OleDbType.VarChar, 255),
                new OleDbParameter("@sCiGongZheng", OleDbType.VarChar, 255),
                new OleDbParameter("@sBingLi",      OleDbType.VarChar, 255),
                new OleDbParameter("@iUserID",      OleDbType.VarChar, 255)
            };
            parameters[0].Value = model.sBianHao;
            parameters[1].Value = model.sCT;
            parameters[2].Value = model.sCiGongZheng;
            parameters[3].Value = model.sBingLi;
            parameters[4].Value = model.iUserID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Maticsoft.Model.s5ShuJuCunZhu DataRowToModel(DataRow row)
 {
     Maticsoft.Model.s5ShuJuCunZhu model = new Maticsoft.Model.s5ShuJuCunZhu();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["sBianHao"] != null)
         {
             model.sBianHao = row["sBianHao"].ToString();
         }
         if (row["sCT"] != null)
         {
             model.sCT = row["sCT"].ToString();
         }
         if (row["sCiGongZheng"] != null)
         {
             model.sCiGongZheng = row["sCiGongZheng"].ToString();
         }
         if (row["sBingLi"] != null)
         {
             model.sBingLi = row["sBingLi"].ToString();
         }
         if (row["iUserID"] != null)
         {
             model.iUserID = row["iUserID"].ToString();
         }
     }
     return(model);
 }
示例#3
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Maticsoft.Model.s5ShuJuCunZhu model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update s5ShuJuCunZhu set ");
            strSql.Append("sBianHao=@sBianHao,");
            strSql.Append("sCT=@sCT,");
            strSql.Append("sCiGongZheng=@sCiGongZheng,");
            strSql.Append("sBingLi=@sBingLi,");
            strSql.Append("iUserID=@iUserID");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@sBianHao",     OleDbType.VarChar, 255),
                new OleDbParameter("@sCT",          OleDbType.VarChar, 255),
                new OleDbParameter("@sCiGongZheng", OleDbType.VarChar, 255),
                new OleDbParameter("@sBingLi",      OleDbType.VarChar, 255),
                new OleDbParameter("@iUserID",      OleDbType.VarChar, 255),
                new OleDbParameter("@ID",           OleDbType.Integer, 4)
            };
            parameters[0].Value = model.sBianHao;
            parameters[1].Value = model.sCT;
            parameters[2].Value = model.sCiGongZheng;
            parameters[3].Value = model.sBingLi;
            parameters[4].Value = model.iUserID;
            parameters[5].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Maticsoft.Model.s5ShuJuCunZhu GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,sBianHao,sCT,sCiGongZheng,sBingLi,iUserID from s5ShuJuCunZhu ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

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

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