示例#1
0
        private void linkLabel4_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            frmInformation f = new frmInformation(DBManager.Properties.Resources.PHPpagesPORTALprocedureDELETE_callexample);

            f.ShowDialog();
            f.Dispose();
        }
        private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            MessageBox.Show("mysqli script is broken, due new method of exchange (server -> client), use v2.3.9 instead.");
            frmInformation i = new frmInformation(DBManager.Properties.Resources.tunnelPHP);

            i.ShowDialog();
        }
示例#3
0
 private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
 {
     if (chkMYSQLtunnelBATCH.Checked)
     {
         frmInformation i = new frmInformation(DBManager.Properties.Resources.tunnelPHPtransBATCH);
         i.ShowDialog();
     }
     else
     {
         frmInformation i = new frmInformation(DBManager.Properties.Resources.tunnelPHPtrans);
         i.ShowDialog();
     }
 }
示例#4
0
        private void btnCopyRows_Click(object sender, EventArgs e)
        {
            if (cmbFROM.Text.Length == 0 || cmbTO.Text.Length == 0 || DG.Rows.Count == 0)
            {
                return;
            }

            //if ((General.dbTypes)General.DB. == General.dbTypes.Access)
            //    if (General.Connections[cmbSourceServer.SelectedIndex].filename.ToLower().EndsWith("xlsx"))
            //        if (General.Mes("WARNING! XLSX import is broken, I couldnt find a solution, shows that rows imported but in the end there is no rows in sheet!\r\n\r\nContinue?",MessageBoxIcon.Exclamation,MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.No)
            //            return;

            DataTable sourceDT;

            if (cmbFROM.SelectedIndex == 0)
            {
                sourceDT = sourceDB.getDatatable(txtCustomSQL.Text);
            }
            else
            {
                //for xls
                if (sourceDB is ADOnet)
                {
                    sourceDT = sourceDB.getDatatable("select * from [" + cmbFROM.Text + "]");
                }
                else
                {
                    sourceDT = sourceDB.getDatatable("select * from " + cmbFROM.Text);
                }
            }

            if (sourceDT != null && sourceDT.Rows.Count == 0)
            {
                MessageBox.Show("Source has no rows!", General.apTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);

                sourceDT.Dispose();

                return;
            }

            List <string> sourceFields = new List <string>();
            List <string> destFields   = new List <string>();
            string        INSsql       = "";
            string        INSfields    = "";
            string        INSvalues    = "";

            string mySQLtunnel_Q_VARS   = "";
            string mySQLtunnel_Q_S_VARS = "";

            for (int i = DG.Rows.Count - 1; i >= 0; i--)
            {
                if (DG.Rows[i].Cells[1].Value == null || DG.Rows[i].Cells[1].Value.ToString().Length == 0)
                {
                    DG.Rows.RemoveAt(i);
                }
                else
                {
                    //INSfields += "[" + DG.Rows[i].Cells[1].Value.ToString() + "],";

                    if (General.DB is MySQLTunnel)
                    {
                        INSfields += DG.Rows[i].Cells[1].Value.ToString() + ",";
                        INSvalues += " ?,";
                    }
                    else
                    {
                        INSfields += DG.Rows[i].Cells[1].Value.ToString() + ",";
                        INSvalues += "@" + DG.Rows[i].Cells[1].Value.ToString() + ",";
                    }

                    sourceFields.Add(DG.Rows[i].Cells[0].Value.ToString());
                    destFields.Add(DG.Rows[i].Cells[1].Value.ToString());
                }
            }

            if (INSfields.Length == 0)
            {
                MessageBox.Show("Nothing to do!", General.apTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            INSfields = INSfields.Substring(0, INSfields.Length - 1);
            INSvalues = INSvalues.Substring(0, INSvalues.Length - 1);

            INSsql = "INSERT INTO " + cmbTO.Text + "(" + INSfields + ") VALUES (" + INSvalues + ")";


            General.dbTypes destDBtype = General.dbTypes.Access;
            if (General.DB is SQLServer)
            {
                destDBtype = General.dbTypes.SQLSERVER;
            }
            else if (General.DB is MySQL)
            {
                destDBtype = General.dbTypes.MySQL;
            }
            else if (General.DB is MySQLTunnel)
            {
                destDBtype = General.dbTypes.MySQLtunnel;
            }
            else if (General.DB is SQLite)
            {
                destDBtype = General.dbTypes.SQLite;
            }
            else if (General.DB is ADOnet)
            {
                INSsql     = "INSERT INTO [" + cmbTO.Text + "](" + INSfields + ") VALUES (" + INSvalues + ")";
                destDBtype = General.dbTypes.Access;
            }


            object result = null;

            if (destDBtype != General.dbTypes.MySQLtunnel)
            {
                result = WaitWindow.Show(CopyRows, "Init...", INSsql, sourceDT, sourceFields, destFields, cmbTO.Text, destDBtype);
            }
            else
            {
                if (chkMYSQLtunnelBATCH.Checked)
                {
                    result = WaitWindow.Show(mySQLtunnel_CopyRowsBATCH, "Init...", INSsql, sourceDT, sourceFields, destFields, cmbTO.Text, destDBtype);
                }
                else
                {
                    result = WaitWindow.Show(mySQLtunnel_CopyRows, "Init...", INSsql, sourceDT, sourceFields, destFields, cmbTO.Text, destDBtype);
                }
            }


            if (sourceDT != null)
            {
                sourceDT.Dispose();
            }

            if (result == null)
            {
                MessageBox.Show("Aborted by user!", General.apTitle, MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else if (result.ToString() == "ok")
            {
                sourceDB.Disconnect();
                this.DialogResult = System.Windows.Forms.DialogResult.Yes;
            }
            else
            {
                if (destDBtype != General.dbTypes.MySQLtunnel)
                {
                    MessageBox.Show(result.ToString(), General.apTitle, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                }
                else
                {
                    frmInformation i = new frmInformation(result.ToString());
                    i.ShowDialog();
                }
            }

            if (cmbFROM.Text.Length == 0 || cmbTO.Text.Length == 0 || DG.Rows.Count == 0)
            {
                return;
            }
        }
        private void linkLabel2_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
        {
            frmInformation i = new frmInformation(DBManager.Properties.Resources.tunnelPHP_PDO);

            i.ShowDialog();
        }