예제 #1
0
        //******************* Delete_user_SQL end *****************

        //******************* View_lista_cuvinte_SQL *****************
        public void View_lista_cuvinte_DEX_DB()    //https://www.w3schools.com/sql/sql_join.asp
        {
            try {
                using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) {
                    connection.Open();

                    sb.Clear();
                    sb.Append("USE " + db_name + "; ");
                    sb.Append("SELECT Cuvant FROM Dictionar_cuvinte ");
                    sql = sb.ToString();
                    DataSet dataSet = new DataSet();
                    using (SqlCommand command = new SqlCommand(sql, connection)) {
                        SqlDataAdapter adapter = new SqlDataAdapter();
                        adapter.SelectCommand = command;
                        adapter.Fill(dataSet);
                        Lista_dictionar.DataContext = dataSet;
                    }
                    connection.Close();
                    Lista_dictionar.UnselectAll();
                }
            }
            catch (SqlException e) {
                Afiseaza_mesaj_SQL(e);
            }
        }
예제 #2
0
        //******************* View_lista_useri_SQL end *****************

        //******************* View_lista_categorii_SQL *****************
        public void View_lista_categorii_DEX_DB()
        {
            try {
                using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) {
                    connection.Open();

                    sb.Clear();
                    sb.Append("USE " + db_name + "; ");
                    sb.Append("SELECT Categorie FROM Dictionar_categorii ");
                    sql = sb.ToString();
                    DataSet dataSet = new DataSet();
                    using (SqlCommand command = new SqlCommand(sql, connection)) {
                        SqlDataAdapter adapter = new SqlDataAdapter();
                        adapter.SelectCommand = command;
                        adapter.Fill(dataSet);
                        Lista_dictionar.DataContext = dataSet;
                    }
                    connection.Close();
                    Lista_dictionar.UnselectAll();
                }
            }
            catch (SqlException e) {
                Afiseaza_mesaj_SQL(e);
            }
        }
예제 #3
0
        //******************* View_lista_categorii_SQL end *****************

        //******************* View_lista_statistici_SQL *****************
        public void View_lista_statistici_DEX_DB()    //https://www.w3schools.com/sql/sql_join.asp
        {
            try {
                // MessageBox.Show("statistici");
                using (SqlConnection connection = new SqlConnection(builder.ConnectionString)) {
                    connection.Open();

                    sb.Clear();
                    sb.Append("USE " + db_name + "; ");
                    sb.Append("SELECT Cuvant,Total_accesari FROM Dictionar_accesari ");
                    sb.Append(" INNER JOIN Dictionar_cuvinte ON Dictionar_accesari.Id_cuvant=Dictionar_cuvinte.Id_cuvant");
                    sql = sb.ToString();
                    DataSet dataSet = new DataSet();
                    using (SqlCommand command = new SqlCommand(sql, connection)) {
                        SqlDataAdapter adapter = new SqlDataAdapter();
                        adapter.SelectCommand = command;
                        adapter.Fill(dataSet);
                        Lista_dictionar.DataContext = dataSet;
                    }
                    connection.Close();
                    Lista_dictionar.Items.Refresh();
                    Lista_dictionar.UnselectAll();
                }
            }
            catch (SqlException e) {
                Afiseaza_mesaj_SQL(e);
            }
        }
예제 #4
0
 private void btn_DelWordCategorie_Click(object sender, RoutedEventArgs e)
 {
     if (radio_cuvinte.IsChecked == true)
     {
         Lista_dictionar.DisplayMemberPath = "Cuvant";
         Delete_dictionar();
         View_lista_cuvinte_DEX_DB();//face refresh la lista curenta
     }
     else if (radio_categorie.IsChecked == true)
     {
         Lista_dictionar.DisplayMemberPath = "Categorie";
         Delete_categorie();
         View_lista_categorii_DEX_DB(); //face refresh la lista curenta
     }
     Lista_dictionar.UnselectAll();     // deselecteaza orice linie selectata
 }