Esempio n. 1
0
        /// <summary>
        /// 该方法用于添加新数据库
        /// </summary>
        public void AddDatabase()
        {
            WinFormAddDatabase mywinform = new Common.WinForm.WinFormAddDatabase();

            mywinform.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            if (mywinform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string tablename = mywinform.tablename;
                string leixing   = mywinform.leixing;
                if (leixing.Equals("标准句"))
                {
                    string str_sql = $"CREATE TABLE {tablename}(xuhao UInt8,bianhao String,shijian Date,laiyuan String,neirong String,redu UInt16) " +
                                     $"ENGINE MergeTree() " +
                                     $"PARTITION BY shijian " +
                                     $"ORDER BY xuhao ";

                    mydb.ExecuteNonQuery(str_sql);
                    System.Windows.Forms.MessageBox.Show($"数据表 {tablename} 已成功添加!");
                }
                else if ((leixing.Equals("标准正文")))
                {
                    string str_sql = $"CREATE TABLE {tablename}(xuhao UInt8,bianhao String,shijian Date,laiyuan String,zhengwenneirong String) " +
                                     $"ENGINE MergeTree() " +
                                     $"PARTITION BY shijian " +
                                     $"ORDER BY xuhao ";
                    //$"PRIMARY KEY bianhao";

                    mydb.Open();
                    mydb.ExecuteNonQuery(str_sql);
                    System.Windows.Forms.MessageBox.Show($"数据表 {tablename} 已成功添加!");
                }
            }
        }
        /// <summary>
        /// 该方法用于添加新数据库
        /// </summary>
        public void AddDatabase()
        {
            WinFormAddDatabase mywinform = new Common.WinForm.WinFormAddDatabase();

            mywinform.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
            if (mywinform.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string tablename = mywinform.tablename;
                string leixing   = mywinform.leixing;
                if (leixing.Equals("标准句"))
                {
                    string str_sql = $"CREATE TABLE {tablename}(序号,编号,时间,来源,内容,热度)";
                    mysqliter.ExecuteRow(str_sql, null, null);
                    System.Windows.Forms.MessageBox.Show($"数据表 {tablename} 已成功添加!");
                }
                else if ((leixing.Equals("标准正文")))
                {
                    string str_sql = $"CREATE TABLE {tablename}(序号,编号,来源,正文内容)";
                    mysqliter.ExecuteRow(str_sql, null, null);
                    System.Windows.Forms.MessageBox.Show($"数据表 {tablename} 已成功添加!");
                }
            }
        }