Beispiel #1
0
        private void BT_BuildSql_Click(object sender, EventArgs e)
        {
            RTB_Content.Clear();
            DataSet ds = CExcel.Import_Excel(TB_BrowseFileName.Text);

            if (ds != null)
            {
                int final = ds.Tables[0].Rows.Count - 1;
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    if (i == 0)
                    {
                        RTB_Content.Text += CSql.GetDataTableNameString(TB_Name.Text) + "\n";
                    }
                    else if (i == ds.Tables[0].Rows.Count - 1)
                    {
                        RTB_Content.Text += CSql.GetDataTableColumnString(ds.Tables[0].Rows[i][0].ToString(), ds.Tables[0].Rows[i][1].ToString(), ds.Tables[0].Rows[i][3].ToString(), true) + "\n";
                    }
                    else
                    {
                        RTB_Content.Text += CSql.GetDataTableColumnString(ds.Tables[0].Rows[i][0].ToString(), ds.Tables[0].Rows[i][1].ToString(), ds.Tables[0].Rows[i][3].ToString(), false) + "\n";
                    }
                }
            }
        }
Beispiel #2
0
        private void BT_SqlInsert_Click(object sender, EventArgs e)
        {
            RTB_Content.Clear();
            DataSet ds = CExcel.Import_Excel(TB_BrowseFileName.Text);

            string[] ColumnName   = new string[ds.Tables[0].Rows.Count - 1];
            string[] ColumnMean   = new string[ds.Tables[0].Rows.Count - 1];
            string[] ColumnStatus = new string[ds.Tables[0].Rows.Count - 1];
            for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
            {
                ColumnName[i]   = ds.Tables[0].Rows[i + 1][0].ToString();
                ColumnMean[i]   = ds.Tables[0].Rows[i + 1][2].ToString();
                ColumnStatus[i] = ds.Tables[0].Rows[i + 1][3].ToString();
            }
            if (ds != null)
            {
                RTB_Content.Text = CSql.SCADA_Insert(ColumnName, TB_Name.Text, ColumnStatus);
            }
        }
Beispiel #3
0
        private void BT_BuildCs_Click(object sender, EventArgs e)
        {
            RTB_Content.Clear();
            DataSet ds = CExcel.Import_Excel(TB_BrowseFileName.Text);

            if (ds != null)
            {
                string[] ColumnName   = new string[ds.Tables[0].Rows.Count - 1];
                string[] ColumnMean   = new string[ds.Tables[0].Rows.Count - 1];
                string[] ColumnStatus = new string[ds.Tables[0].Rows.Count - 1];
                for (int i = 0; i < ds.Tables[0].Rows.Count - 1; i++)
                {
                    ColumnName[i]   = ds.Tables[0].Rows[i + 1][0].ToString();
                    ColumnMean[i]   = ds.Tables[0].Rows[i + 1][2].ToString();
                    ColumnStatus[i] = ds.Tables[0].Rows[i + 1][3].ToString();
                }
                RTB_Content.Text += CSql.GetCsUsingString();
                RTB_Content.Text += CSql.GetCsClassHeadString(TB_Name.Text);
                RTB_Content.Text += CSql.GetCsClassShuXingString(ColumnName);
                RTB_Content.Text += CSql.GetCsClassRegionString(ColumnName, ColumnMean);
                RTB_Content.Text += CSql.GetCsClassFunctionString(ColumnName, TB_Name.Text, ColumnStatus);
            }
        }