コード例 #1
0
        /// <summary>
        /// 用ZYJS对象插入或更新条检测数据
        /// </summary>
        /// <param name=""></param>
        /// <returns>int 0为失败,1为插入成功</returns>
        public int Save_ZYJS_XZGB(ZYJS_XZGB zyjs)
        {
            string sqli = "insert into ZYJS_XZGB(ZRDate20011001btgxz,WLDate20011001btgxz) values(@ZRDate20011001btgxz,@WLDate20011001btgxz)";

            SqlParameter[] spr =
            {
                new SqlParameter("@ZRDate20011001btgxz", zyjs.ZRDate20011001btgxz),
                new SqlParameter("@WLDate20011001btgxz", zyjs.WLDate20011001btgxz),
            };
            try
            {
                if (Have_GB("ZYJS_XZGB"))
                {
                    //删除原来所有数据再插入新数据
                    string sql = "delete from ZYJS_XZGB";
                    DBHelperSQL.Execute(sql);
                    //插入新数据
                    if (DBHelperSQL.Execute(sqli, spr) > 0)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
                else
                {
                    //插入新数据
                    if (DBHelperSQL.Execute(sqli, spr) > 0)
                    {
                        return(1);
                    }
                    else
                    {
                        return(0);
                    }
                }
            }
            catch (Exception)
            {
                throw;
            }
        }
コード例 #2
0
        /// <summary>
        /// 查询一条自由加速限值国标
        /// </summary>
        /// <returns>ZYJS_XZGB</returns>
        public ZYJS_XZGB Get_ZYJS_XZGB()
        {
            string    sql       = "select * from ZYJS_XZGB";
            ZYJS_XZGB zyjs_xzgb = new ZYJS_XZGB();

            try
            {
                DataTable dt = DBHelperSQL.GetDataTable(sql);
                if (dt.Rows.Count > 0)
                {
                    zyjs_xzgb.ZRDate20011001btgxz = dt.Rows[0]["ZRDate20011001btgxz"].ToString();
                    zyjs_xzgb.WLDate20011001btgxz = dt.Rows[0]["WLDate20011001btgxz"].ToString();
                }
                return(zyjs_xzgb);
            }
            catch (Exception)
            {
                throw;
            }
        }