コード例 #1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Tunnel.Model.Tunnel_bum GetModel(long b_id)
        {
            SqlParameter[] parameters =
            {
                new SqlParameter("@b_id", SqlDbType.BigInt)
            };
            parameters[0].Value = b_id;

            Tunnel.Model.Tunnel_bum model = new Tunnel.Model.Tunnel_bum();
            DataSet ds = DbHelperSQL.RunProcedure("Tunnel_bum_GetModel", parameters, "ds");

            if (ds.Tables[0].Rows.Count > 0)
            {
                if (ds.Tables[0].Rows[0]["b_id"].ToString() != "")
                {
                    model.b_id = long.Parse(ds.Tables[0].Rows[0]["b_id"].ToString());
                }
                model.b_name = ds.Tables[0].Rows[0]["b_name"].ToString();
                if (ds.Tables[0].Rows[0]["b_hid"].ToString() != "")
                {
                    model.b_hid = int.Parse(ds.Tables[0].Rows[0]["b_hid"].ToString());
                }
                model.b_depict = ds.Tables[0].Rows[0]["b_depict"].ToString();
                return(model);
            }
            else
            {
                return(null);
            }
        }
コード例 #2
0
        /// <summary>
        ///  更新一条数据
        /// </summary>
        public void Update(Tunnel.Model.Tunnel_bum model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@b_id",     SqlDbType.BigInt,    8),
                new SqlParameter("@b_name",   SqlDbType.VarChar, 100),
                new SqlParameter("@b_hid",    SqlDbType.Int,       4),
                new SqlParameter("@b_depict", SqlDbType.VarChar, 1000)
            };
            parameters[0].Value = model.b_id;
            parameters[1].Value = model.b_name;
            parameters[2].Value = model.b_hid;
            parameters[3].Value = model.b_depict;

            DbHelperSQL.RunProcedure("Tunnel_bum_Update", parameters, out rowsAffected);
        }
コード例 #3
0
        /// <summary>
        ///  增加一条数据
        /// </summary>
        public int Add(Tunnel.Model.Tunnel_bum model)
        {
            int rowsAffected;

            SqlParameter[] parameters =
            {
                new SqlParameter("@b_id",     SqlDbType.BigInt,    8),
                new SqlParameter("@b_name",   SqlDbType.VarChar, 100),
                new SqlParameter("@b_hid",    SqlDbType.Int,       4),
                new SqlParameter("@b_depict", SqlDbType.VarChar, 1000)
            };
            parameters[0].Direction = ParameterDirection.Output;
            parameters[1].Value     = model.b_name;
            parameters[2].Value     = model.b_hid;
            parameters[3].Value     = model.b_depict;

            DbHelperSQL.RunProcedure("Tunnel_bum_ADD", parameters, out rowsAffected);
            return(int.Parse(parameters[0].Value.ToString()));
        }