Beispiel #1
0
        private void Export()
        {
            string sScript = string.Empty;

            if (txtBase.Text.Length == 0  || txtPathScript.Text.Length == 0 )
            {
                MessageBox.Show("VERIFIQUE Base","Campos Requeridos", MessageBoxButtons.OK,MessageBoxIcon.Warning);
                return;
            }
            if (txtServer.Text.Length == 0)
            {
                MessageBox.Show("VERIFIQUE Server", "Campos Requeridos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (txtPathScript.Text.Length == 0)
            {
                MessageBox.Show("VERIFIQUE PATH donde dejar el Script, presione 'Open' para seleccionarlo.", "Campos Requeridos", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            if (gvTablesSQL.Rows.Count == 0)
            {
                MessageBox.Show("Verifique las tablas seleccionadas", "verifique tablas seleccionadas", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return;
            }

            try
            {

                SQLServerManager oSql = new SQLServerManager(txtBase.Text, txtServer.Text, txtUser.Text, txtPassword.Text, txtSchema.Text, chkIntegratedSecurity.Checked);

                if (opPunto.Checked)
                {
                    oSql.Lenguaje = SQLServerManager.LenguajePuntoComa.Punto;
                }
                else
                {
                    oSql.Lenguaje = SQLServerManager.LenguajePuntoComa.Coma;
                }

                if (opOracle.Checked)
                {
                    sScript = oSql.SaveOutputScript_Oracle(gvTablesSQL.GetSeleccionados("chkSel", "nombre"));
                }
                if (opSQL2000.Checked)
                {
                    sScript = oSql.SaveOutputScript_SQL2000(gvTablesSQL.GetSeleccionados("chkSel", "nombre"));
                }
                if (opSQL2005.Checked)
                {
                    sScript = oSql.SaveOutputScript_SQL2005(gvTablesSQL.GetSeleccionados("chkSel", "nombre"));
                }

                File.AppendAllText(_PathScript, sScript, Encoding.UTF8);

            }
            catch (Exception ex)
            {
                MessageBox.Show( ex.ToString(),"error", MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
        }
Beispiel #2
0
        private void GetTables()
        {
            DataSet ds = new DataSet();
            if (txtBase.Text.Length == 0 || txtServer.Text.Length == 0)
            {
                return;
            }
            SQLServerManager oSql = new SQLServerManager(txtBase.Text, txtServer.Text, txtUser.Text, txtPassword.Text,txtSchema.Text,chkIntegratedSecurity.Checked);
            ds = oSql.GetTables();
            gvTablesSQL.DataSource = ds.Tables["tablanombres"];

            if (ds.Tables["tablarelaciones"].Rows.Count > 1 )
            {
                gvTablesSQL.SelectRows("chksel", "id", ds.Tables["tablarelaciones"], "id");
                MessageBox.Show("Se han encontrado tablas con relaciones. Para no romper con la INTEGRIDAD REFERENCIAL debe incluirlas, en caso contrario, no podra insertar otras que dependen de ellas", "Integridad Referencial", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }