*.[改进]Itrycn_Project2新增数据库版本配置,当数据库版本不符时提醒。

This commit is contained in:
鑫Intel 2020-12-04 17:06:59 +08:00
parent d8e0f01af1
commit 5084054674
20 changed files with 22834 additions and 22790 deletions

Binary file not shown.

View File

@ -1,6 +1,8 @@
using ryCommonDb;
using ryCommon;
using ryCommonDb;
using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using static ryCommonDb.DataProvider;
@ -46,15 +48,78 @@ namespace Itrycn_Project
db.CreateDb(mySQL);
#endregion
//
#region 2
#region
mySQL.Clear();
mySQL.TableName = "表2";
mySQL.AddField("", "");
mySQL.TableName = "Setting";
mySQL.AddField("name", "");
mySQL.AddField("info", "");
db.CreateDb(mySQL);
#endregion
}
db.Free();
}
/// <summary>
/// 保存设置
/// </summary>
/// <returns>返回大于0的数,表示设置成功,否则表示失败</returns>
private static int SetSetting(string name ,string info)
{
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
if (db.ConnDb(Itrycn_Db.SQLConnStr) == 1)
{
RyQuickSQL mySQL = new RyQuickSQL("Setting");
mySQL.AddField("name", name);
mySQL.AddField("info", info);
var result = db.ExecuteNonQuery(mySQL.GetUpdateSQL() + " where name='" + name + "'", mySQL);
if (result == 0)
{
result=db.ExecuteNonQuery(mySQL.GetInsertSQL(), mySQL);
}
return result;
}
db.Free();
return -1000;
}
/// <summary>
///获取设置
/// </summary>
/// <returns></returns>
private static string GetSetting(string name, string defValue)
{
DataProvider mydb = new DataProvider();
IDbInterface db = Itrycn_Db.CreateDataProvider(Itrycn_Db.dataType);
var result = defValue;
if (db.ConnDb(Itrycn_Db.SQLConnStr) == 1)
{
DataSet ds = db.ReadData("select * from Setting where name='"+ name + "'");
if (mydb.HaveData(ds))
{
DataRow reader = ds.Tables[0].Rows[0];
#region
result = reader["Name"].ToString();
#endregion
}
}
db.Free();
return result;
}
/// <summary>
/// 获取数据库版本
/// </summary>
/// <returns></returns>
public static int GetDbVer()
{
return GetSetting("dbVer","1").ToInt();
}
/// <summary>
/// 设置数据库版本
/// </summary>
/// <returns></returns>
public static int SetDbVer(int DbVer)
{
return SetSetting("dbVer", DbVer.ToString());
}
public static void CreateTable()
{
CreateTable(dataType, SQLConnStr);

View File

@ -41,12 +41,9 @@
this.ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.chromeTabControl1 = new ryControls.ChromeTabControl();
this.tabPage1 = new System.Windows.Forms.TabPage();
this.richTextBox21 = new ryControls.Controls.RichTextBox2();
this.extendedWebBrowser1 = new ExtendedWebBrowser2.ExtendedWebBrowser();
this.MenuTray.SuspendLayout();
this.menuStrip1.SuspendLayout();
this.chromeTabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.SuspendLayout();
//
// notifyIcon1
@ -133,8 +130,6 @@
//
// tabPage1
//
this.tabPage1.Controls.Add(this.extendedWebBrowser1);
this.tabPage1.Controls.Add(this.richTextBox21);
this.tabPage1.Location = new System.Drawing.Point(1, 29);
this.tabPage1.Name = "tabPage1";
this.tabPage1.Padding = new System.Windows.Forms.Padding(3);
@ -143,29 +138,6 @@
this.tabPage1.Text = "首页";
this.tabPage1.UseVisualStyleBackColor = true;
//
// richTextBox21
//
this.richTextBox21.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox21.DetectUrls = false;
this.richTextBox21.EmptyText = "cc对对对反反复复";
this.richTextBox21.ForeColor = System.Drawing.Color.Black;
this.richTextBox21.Location = new System.Drawing.Point(164, 79);
this.richTextBox21.Name = "richTextBox21";
this.richTextBox21.OnlyInputText = true;
this.richTextBox21.Size = new System.Drawing.Size(385, 195);
this.richTextBox21.TabIndex = 0;
this.richTextBox21.Text = "";
//
// extendedWebBrowser1
//
this.extendedWebBrowser1.ForceOpenThisWindow = false;
this.extendedWebBrowser1.Location = new System.Drawing.Point(124, 77);
this.extendedWebBrowser1.MinimumSize = new System.Drawing.Size(20, 20);
this.extendedWebBrowser1.Name = "extendedWebBrowser1";
this.extendedWebBrowser1.ScriptErrorsSuppressed = true;
this.extendedWebBrowser1.Size = new System.Drawing.Size(250, 250);
this.extendedWebBrowser1.TabIndex = 1;
//
// FrmStart
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
@ -183,7 +155,6 @@
this.menuStrip1.ResumeLayout(false);
this.menuStrip1.PerformLayout();
this.chromeTabControl1.ResumeLayout(false);
this.tabPage1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@ -201,7 +172,5 @@
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItem;
private ryControls.Controls.RichTextBox2 richTextBox21;
private ExtendedWebBrowser2.ExtendedWebBrowser extendedWebBrowser1;
}
}

View File

@ -127,10 +127,20 @@ namespace Itrycn_Project2
private void FrmStart_Load(object sender, EventArgs e)
{
//Itrycn_Project.Itrycn_Db.CreateTable();
Itrycn_Project.Itrycn_Db.CreateTable();
LiveUpdate.RyUpdate update = new LiveUpdate.RyUpdate(Soft_Info.Update_Url);
update.CheckUpdate();
RyFiles.GetRelativePath("%cc");
var dbver = Itrycn_Db.GetDbVer();
if(dbver==1) //初始版本,并是当前要求的数据库
{
}
else
{
MessageBox.Show("不支持当前数据库版本,这可能是以下原因导致的:\r\n1.数据库已损坏;'\r\n2.当前数据库是由新版软件创建的(请更新软件后重试)。", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
Application.Exit();
return;
}
}
}
}