Exemplo n.º 1
0
        public int SetVersion(bool update)
        {
            string sql = "";

            if (update)
            {
                sql = string.Format("UPDATE files SET note='{0}' WHERE (path='build') AND (md5='build')", Internal.VERSION);
                DB.ExecuteCommand(sql);
            }
            else
            {
                sql = string.Format("SELECT * FROM files WHERE (path='build') AND (md5='build')");
                DataTable dt = DB.ExecuteQuery(sql);
                if (dt.Rows.Count > 0)
                {
                    string ver     = dt.Rows[0]["note"].ToString();
                    int    version = System.Convert.ToInt32(ver);
                    return(version);
                }
                else
                {
                    sql = string.Format("INSERT INTO files (path,md5,note) VALUES ('build','build','{0}')", Internal.VERSION);
                    DB.ExecuteCommand(sql);
                }
            }
            return(Internal.VERSION);
        }