示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="project"></param>
        /// <param name="majorVersion"></param>
        /// <param name="minorVersion"></param>
        /// <param name="revisionVersion"></param>
        public void VerifyDBInfo(string project, int majorVersion,
                                 int minorVersion, int revisionVersion)
        {
            DBInfo dbinfo = this.GetDBInfo();

            if (dbinfo == null)
            {
                throw new DBInfoException("not find DBInfo");
            }

            if (StringHelper.Equal(project, dbinfo.Project) &&
                majorVersion == dbinfo.MajorVersion &&
                minorVersion == dbinfo.MinorVersion &&
                revisionVersion == dbinfo.RevisionVersion)
            {
                return;
            }
            else
            {
                string expectedVersion = string.Format("{0}.{1}.{2}", majorVersion, minorVersion, revisionVersion);
                string s = string.Format("Expected project '{0} V{1}', but was '{2} V{3}'",
                                         project, expectedVersion, dbinfo.Project, dbinfo.VersionString);
                throw new DBInfoException(s);
            }
        }
示例#2
0
        /// <summary>
        /// 获取数据库信息,如不存在返回null
        /// </summary>
        /// <returns></returns>
        public DBInfo GetDBInfo()
        {
            DBInfo    dbinfo = null;
            string    sql    = "select top 1 * from tblDBInfo order by DBInfoID desc";
            DataTable tbl    = this.ExecuteDataTable(sql);

            if (tbl.Rows.Count > 0)
            {
                DataRow row = tbl.Rows[0];
                dbinfo = new DBInfo();
                dbinfo.MajorVersion    = Convert.ToInt32(row["MajorVersion"]);
                dbinfo.MinorVersion    = Convert.ToInt32(row["MinorVersion"]);
                dbinfo.RevisionVersion = Convert.ToInt32(row["RevisionVersion"]);
                dbinfo.Project         = row["Project"].ToString().Trim();
                dbinfo.DT = Convert.ToDateTime(row["DT"]);
            }
            return(dbinfo);
        }
示例#3
0
文件: DBIBase.cs 项目: hkiaipc/yh
 /// <summary>
 /// 获取数据库信息,如不存在返回null
 /// </summary>
 /// <returns></returns>
 public DBInfo GetDBInfo()
 {
     DBInfo dbinfo = null;
     string sql = "select top 1 * from tblDBInfo order by DBInfoID desc";
     DataTable tbl = this.ExecuteDataTable(sql);
     if (tbl.Rows.Count > 0)
     {
         DataRow row = tbl.Rows[0];
         dbinfo = new DBInfo();
         dbinfo.MajorVersion = Convert.ToInt32(row["MajorVersion"]);
         dbinfo.MinorVersion = Convert.ToInt32(row["MinorVersion"]);
         dbinfo.RevisionVersion = Convert.ToInt32(row["RevisionVersion"]);
         dbinfo.Project = row["Project"].ToString().Trim();
         dbinfo.DT = Convert.ToDateTime(row["DT"]);
     }
     return dbinfo;
 }