예제 #1
0
        private void DBCC_Button_Pressed(object sender, EventArgs e)
        {
            ConectarSQL conectar = new ConectarSQL();
            string      headers  = "Error,Level,State,MessageText,ReapirLevel,Status,DBLD,DBFragID,ObjectID,IndexID,PartitionID,AllocUnitId,RidDBLD,RidPruld,File,Page,Slot,RefDbld,RefPruld,RedFile,RefPage,RefSlot,Allocation\n";
            string      result   = conectar.chequeoBase(user_database_name_input.Text, user_text_area_input.Text);

            resultados_text_area.Text = headers + result;
        }
예제 #2
0
        private void relation_tables_button_pressed(object sender, EventArgs e)
        {
            ConectarSQL conectar  = new ConectarSQL();
            string      headers   = "\n";
            string      resultado = conectar.get_relation_tables(user_database_name_input.Text, "sdfasdf");

            resultados_text_area.Text = resultado;
        }
예제 #3
0
        private void pk_button_pressed(object sender, EventArgs e)
        {
            ConectarSQL conectar = new ConectarSQL();


            //DialogResult dialogResult = MessageBox.Show("query",sql);
            //user_text_area_input.Text
            string headers   = "";
            string resultado = conectar.get_no_pk_tables(user_database_name_input.Text, "sdfasdf");

            resultados_text_area.Text = resultado;
        }
예제 #4
0
        private void Auditar_Button_Pressed(object sender, EventArgs e) //conecta a sql server y ejecuta el comando del text area - deja cerrada la conexion
        {
            ConectarSQL conectar = new ConectarSQL();


            //DialogResult dialogResult = MessageBox.Show("query",sql);
            //user_text_area_input.Text
            string headers = "";

            resultados_text_area.Text = conectar.auditarbase(user_database_name_input.Text, user_text_area_input.Text);

            //Console.WriteLine(sql);
        }
예제 #5
0
        private void button2_Click(object sender, EventArgs e)
        {
            ConectarSQL   conectar = new ConectarSQL();
            List <string> lista    = new List <string>();
            List <string> colnames = new List <string>();
            int           count1   = 0;
            int           count2   = 0;
            string        aux      = @"select  name
						   from sys.tables"                        ;
            string        countFK  = @"select count(*)
							from sys.foreign_key_columns"                            ;

            //resultados_text_area.Text = conectar.getIR(user_database_name_input.Text, aux);
            lista = conectar.getIR(user_database_name_input.Text, aux);

            foreach (string item in lista)
            {
                Console.WriteLine(item);
            }
            count1 = conectar.getFK(user_database_name_input.Text, countFK);
            Console.WriteLine(count1);
            for (int i = 1; i < lista.Count; i++)
            {
                if (!(lista.ElementAt(i).Equals("sysdiagrams")) && !(lista.ElementAt(i).Equals("ARef_Integrity")))
                {
                    colnames = conectar.getColName(user_database_name_input.Text, lista.ElementAt(i));
                    for (int j = i + 4; j < colnames.Count; j++)
                    {
                        //Console.WriteLine(var);
                        count2 += conectar.getMatch(user_database_name_input.Text, lista.ElementAt(i), colnames.ElementAt(j));
                        //	MessageBox.Show(lista.ele);
                    }
                }
            }

            ///////////////////////////


            int finalpeque = 0;

            for (int i = 0; i < lista.Count; i++)
            {
                Console.WriteLine("==============================\n");
                if (!(lista.ElementAt(i).Equals("sysdiagrams")) && !(lista.ElementAt(i).Equals("ARef_Integrity")))
                {
                    /*colnames = conectar.getColName(user_database_name_input.Text, lista.ElementAt(i));
                     * for (int j = 0; j < colnames.Count; j++)
                     * {
                     *      //Console.WriteLine(var);
                     *      count2 += conectar.getMatch(user_database_name_input.Text, lista.ElementAt(i), colnames.ElementAt(j));
                     *
                     * }*/

                    colnames = conectar.getColName(user_database_name_input.Text, lista.ElementAt(i));
                    for (int j = i + 1; j < lista.Count; j++)
                    {
                        string print = lista.ElementAt(i) + " vs " + lista.ElementAt(j);
                        Console.Write(print + "\n");
                        List <string> pequeaux = conectar.getColName(user_database_name_input.Text, lista.ElementAt(j));

                        foreach (string colorigin in colnames)
                        {
                            foreach (string coldest in pequeaux)
                            {
                                if (colorigin.Equals(coldest))
                                {
                                    //	Console.WriteLine("equals === " + colorigin+" vs " + coldest);
                                    finalpeque++;
                                }
                            }
                        }
                    }
                }
            }
            Console.WriteLine(count2);
            if ((count2 - count1) != 0)
            {
                resultados_text_area.Text = "FK faltantes " + (count2 - count1).ToString();
            }
            else
            {
                resultados_text_area.Text = "No existen fk faltantes";
            }

            //resultados_text_area.Text = "hola" + finalpeque;
        }