Merge branch 'master' of http://www.scserverddns.top:13000/sc/DyeingComputer
This commit is contained in:
commit
1cada6a732
2 files changed
+50
-3
No files matched your search
+2
-1
@@ -15,6 +15,7 @@ using System.Windows.Media;
|
|||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using System.Windows.Navigation;
|
using System.Windows.Navigation;
|
||||||
using System.Windows.Shapes;
|
using System.Windows.Shapes;
|
||||||
|
using formula_manage.UserClass;
|
||||||
|
|
||||||
namespace DyeingComputer
|
namespace DyeingComputer
|
||||||
{
|
{
|
||||||
@@ -26,7 +27,7 @@ namespace DyeingComputer
|
|||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
SqliteHelper.Strat();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RadioButton_toolbar(object sender, RoutedEventArgs e)
|
private void RadioButton_toolbar(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ using Microsoft.Data.Sqlite;
|
|||||||
using System.Data.Common;
|
using System.Data.Common;
|
||||||
using System.Windows.Media.Animation;
|
using System.Windows.Media.Animation;
|
||||||
using System.Data.SQLite;
|
using System.Data.SQLite;
|
||||||
|
using System.Windows.Shapes;
|
||||||
|
|
||||||
namespace DyeingComputer.UserClass
|
namespace DyeingComputer.UserClass
|
||||||
{
|
{
|
||||||
@@ -23,7 +24,7 @@ namespace DyeingComputer.UserClass
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据库地址
|
/// 数据库地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly string dbFile = Environment.CurrentDirectory + "\\DataBase\\COMPUTER.db;Version3";
|
private static string dbFile = Environment.CurrentDirectory + "\\DataBase\\800COMPUTER.db";
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 数据库密码
|
/// 数据库密码
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -34,7 +35,7 @@ namespace DyeingComputer.UserClass
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="dataFile"></param>
|
/// <param name="dataFile"></param>
|
||||||
/// <returns>SQLiteConnection 类</returns>
|
/// <returns>SQLiteConnection 类</returns>
|
||||||
private SQLiteConnection OpenConnection(string dataFile)
|
public static SQLiteConnection OpenConnection(string dataFile)
|
||||||
{
|
{
|
||||||
if (dataFile == null)
|
if (dataFile == null)
|
||||||
{
|
{
|
||||||
@@ -43,7 +44,24 @@ namespace DyeingComputer.UserClass
|
|||||||
if (!File.Exists(dataFile))
|
if (!File.Exists(dataFile))
|
||||||
{
|
{
|
||||||
SQLiteConnection.CreateFile(dataFile);
|
SQLiteConnection.CreateFile(dataFile);
|
||||||
|
///工艺程序名
|
||||||
|
NewTable(dataFile, "ProgramName","(ProgramName varchar, ProgramID int, Step int, Time varchar, Notes varchar)");
|
||||||
|
///工艺步骤细节
|
||||||
|
NewTable(dataFile, "ProgramSteps",
|
||||||
|
"(Program varchar, Step int, StepID int, StepName varchar, ParameterName varchar, " +
|
||||||
|
"Parameter1 int, Parameter2 int, Parameter3 int, Parameter4 int, Parameter5 int)");
|
||||||
|
///历史
|
||||||
|
///
|
||||||
|
///曲线
|
||||||
|
///
|
||||||
|
///计划
|
||||||
|
///
|
||||||
|
///参数
|
||||||
|
///
|
||||||
|
///输入输出
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SQLiteConnection conn = new SQLiteConnection();
|
SQLiteConnection conn = new SQLiteConnection();
|
||||||
SQLiteConnectionStringBuilder conStr = new SQLiteConnectionStringBuilder
|
SQLiteConnectionStringBuilder conStr = new SQLiteConnectionStringBuilder
|
||||||
{
|
{
|
||||||
@@ -55,5 +73,33 @@ namespace DyeingComputer.UserClass
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static void Strat()
|
||||||
|
{
|
||||||
|
OpenConnection(dbFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 创建表
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="dbPath">指定数据库文件</param>
|
||||||
|
/// <param name="tableName">表名称</param>
|
||||||
|
static public void NewTable(string dbPath, string tableName ,string dat)
|
||||||
|
{
|
||||||
|
SQLiteConnection sqliteConn = new SQLiteConnection("data source=" + dbPath);
|
||||||
|
if (sqliteConn.State != System.Data.ConnectionState.Open)
|
||||||
|
{
|
||||||
|
sqliteConn.Open();
|
||||||
|
SQLiteCommand cmd = new SQLiteCommand();
|
||||||
|
cmd.Connection = sqliteConn;
|
||||||
|
cmd.CommandText = "CREATE TABLE " + tableName + dat;//"(Name varchar,Team varchar, Number varchar)";
|
||||||
|
cmd.ExecuteNonQuery();
|
||||||
|
}
|
||||||
|
sqliteConn.Close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user