コード例 #1
0
ファイル: Form1.cs プロジェクト: z-klar/SQLAnalysis
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnCreateSql_Click(object sender, EventArgs e)
        {
            string server, db, user, pwd;

            server = txDatabaseServer.Text;
            db     = "master";
            user   = txUserName.Text;
            pwd    = txPassword.Text;

            SP = new SqlProcessing(server, db, user, pwd);
        }
コード例 #2
0
        /// <summary>
        ///
        /// </summary>
        private void ExecuteFillCmd1()
        {
            string        db, table, column, sCmd;
            int           nDataType, min, max, step, i, iRes = 0;
            SqlProcessing SP;

            db        = cbFillDatabases.SelectedItem.ToString();
            table     = cbFillTables.SelectedItem.ToString();
            column    = cbFillColumn.SelectedItem.ToString();
            nDataType = cbFillDataTypes.SelectedIndex;
            if (nDataType == -1)
            {
                MessageBox.Show("No Data Type selected !");
                return;
            }

            min  = Convert.ToInt32(txFillMin.Text);
            max  = Convert.ToInt32(txFillMax.Text);
            step = Convert.ToInt32(txFillStep.Text);

            SP = new SqlProcessing(txDatabaseServer.Text, db, txUserName.Text, txPassword.Text);

            if (nDataType == 0)  // NUMBER
            {
                for (i = min; i < max; i += step)
                {
                    sCmd = string.Format("INSERT into {0} ({1}) values ({2})", table, column, i);
                    SP.ExecNonQuery(sCmd);
                    if (ProcessSqlErrors(0) > 0)
                    {
                        iRes = 1;
                    }
                }
                if (iRes != 0)
                {
                    MessageBox.Show("Errors during processing - see the Logger Window !");
                }
            }
            else if (nDataType == 1)     // string
            {
                MessageBox.Show("STRING not supported !");
            }
            else    // Date/Time
            {
                MessageBox.Show("DATE / TIME not supported !");
            }
        }
コード例 #3
0
        /// <summary>
        ///
        /// </summary>
        private void GenerateFillCommand1()
        {
            string        db, table, column, sCmd;
            int           nDataType, min, max, step, i;
            SqlProcessing SP;

            db        = cbFillDatabases.SelectedItem.ToString();
            table     = cbFillTables.SelectedItem.ToString();
            column    = cbFillColumn.SelectedItem.ToString();
            nDataType = cbFillDataTypes.SelectedIndex;
            if (nDataType == -1)
            {
                MessageBox.Show("No Data Type selected !");
                return;
            }

            min  = Convert.ToInt32(txFillMin.Text);
            max  = Convert.ToInt32(txFillMax.Text);
            step = Convert.ToInt32(txFillStep.Text);

            SP = new SqlProcessing(txDatabaseServer.Text, db, txUserName.Text, txPassword.Text);

            if (nDataType == 0)  // NUMBER
            {
                sCmd           = string.Format("INSERT into {0} ({1}) values ({2})", table, column, min);
                txFillCmd.Text = sCmd;
            }
            else if (nDataType == 1)     // string
            {
                MessageBox.Show("STRING not supported !");
            }
            else    // Date/Time
            {
                MessageBox.Show("DATE / TIME not supported !");
            }
        }