Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make filter to DataView?
    primarykey
    data
    text
    <p><img src="https://i.stack.imgur.com/gl5k5.jpg" alt="enter image description here">I have a problem with taking the TreeView filter because the selected country needs to have the Discipline to the list of events they might not assigned to country and from all disciplines . I was thinking of downloading the parent node , but I have not found such an option . Part of the XAML code :</p> <pre><code>&lt;TreeView X:Name="drzewo" Height="380" width="280" MouseDoubleClick="drzewo_MouseDoubleClick"/&gt; </code></pre> <p>Method drzewo_MouseDoubleClick C # :</p> <pre><code>private void drzewo_MouseDoubleClick ( object sender , MouseButtonEventArgs e)         {             TreeView v = e.Source as TreeView ;             string str = v.SelectedValue.ToString ();             drzewo_klik = str.Substring (46, str.IndexOf ( " Items.Count " ) -47 ) ;             for (int i = 0; i &lt; listadyscyplina.Count , i + + )             {                     if ( listadyscyplina.Contains ( drzewo_klik ) )                     {                         flagadyscyplina = true;                         drzewo_dyscyplina = drzewo_klik ;                         break;                     }             }                          for (int i = 0; i &lt; listakontynent.Count , i + + )             {                 if ( listakontynent.Contains ( drzewo_klik ) )                 {                     flagakontynent = true;                     drzewo_kontynent = drzewo_klik ;                     break;                 }             }             for (int i = 0; i &lt; listakraj.Count , i + + )             {                 if ( listakraj.Contains ( drzewo_klik ) )                 {                     flagakraj = true;                     drzewo_kraj = drzewo_klik ;                     break;                 }             }             for (int i = 0; i &lt; listalig.Count , i + + )             {                 if ( listalig.Contains ( drzewo_klik ) )                 {                     flagaliga = true;                     drzewo_liga = drzewo_klik ;                     break;                 }             }             sort ();         }   </code></pre> <p>                    listadyscyplina , listakontynent , listakraj and listalig is a list of all the disciplines , continents, countries and leagues extracted from the database .</p> <p>C # sort method :</p> <pre><code>private void sort ( )         {             ZdarzeniaDataGrid.ItemsSource = null;             dataSource3.Clear ();                          if ( flagaliga == true &amp;&amp; flagasystem == true &amp;&amp; flagakraj == true &amp;&amp; flagadyscyplina == true &amp;&amp; flagakontynent == true)                 sort1 ();             else if ( flagasystem == true &amp;&amp; flagakraj == true &amp;&amp; flagadyscyplina == true &amp;&amp; flagakontynent == true)                 sort2 ();             else if ( flagakraj == true &amp;&amp; flagadyscyplina == true &amp;&amp; flagakontynent == true)                 sort3 ();             else if ( flagadyscyplina == true &amp;&amp; flagakontynent == true)                 sort4 ();             else if ( flagadyscyplina == true)                 sort5 ();             ZdarzeniaDataGrid.Items.Refresh ();             ZdarzeniaDataGrid.ItemsSource = dataSource3 ;         } </code></pre> <p>Methods of sort1 to sort5 C #</p> <p>  </p> <pre><code>private void sort2 ( )         {             licznikz int = 0;             using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )             {                 SqlCommand command = new SqlCommand ( "select IdKlubu , IdKlubu2 from event where IdLigi = (select IdLigi from League where ( Name = ' " + drzewo_liga + " ' AND IdDyscypliny = (select IdDyscypliny from discipline where name = ' " + drzewo_dyscyplina + "' ) AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' "+ drzewo_kraj + " ') AND SystemRozgrywek = ' "+ drzewo_system +"' AND ( Season = '2013 'OR Season = '2013 / 2014 ' ) )) " conn) ;                 SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                 dss5 = new DataSet ();                 adapter.Fill ( dss5 , "Event" ) ;             }             licznikz = dss5.Tables [ "Event" ] . Rows.Count ;             DataRow napis6 = null;             DataRow napis1 = null;             DataRow napis2 = null;             DataSet DSSS = null;             for ( int n = 0, n &lt; licznikz n + + )             {                 napis6 = dss5.Tables [ "Event" ] . Rows [n ] ;                 using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                 {                     SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue (0) . ToString ( ) + "' ", conn) ;                     SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                     DSSS = new DataSet ();                     adapter.Fill ( DSSS , " Club ");                 }                 napis1 = dsss.Tables [" Club "] . Rows [0] ;                 using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                 {                     SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue ( 1). ToString ( ) + "' ", conn) ;                     SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                     DSSS = new DataSet ();                     adapter.Fill ( DSSS , " Club ");                 }                 napis2 = dsss.Tables [" Club "] . Rows [0] ;                 for (int i = 0; i &lt; dataSource.Count , i + + )                 {                     if ( dataSource [i] . NazwaLigi.Contains ( napis.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [i] . Gospodarze.Contains ( napis1.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [ i] . Goście.Contains ( napis2.ItemArray.GetValue (0) . ToString ( )))                     {                         dataSource3.Add ( dataSource [i] ) ;                     }                 }             }         }         private void sort1 ( )         {             licznikz int = 0;             using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )             {                 SqlCommand command = new SqlCommand ( "select IdKlubu , IdKlubu2 from event where IdLigi = (select IdLigi from League where ( Name = ' " + drzewo_liga + " ' AND IdDyscypliny = (select IdDyscypliny from discipline where name = ' " + drzewo_dyscyplina + "' ) AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' "+ drzewo_kraj + " ') AND (Season = '2013 'OR Season = '2013 / 2014 ' ))) " , conn) ;                 SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                 dss5 = new DataSet ();                 adapter.Fill ( dss5 , "Event" ) ;             }             licznikz = dss5.Tables [ "Event" ] . Rows.Count ;             DataRow napis6 = null;             DataRow napis1 = null;             DataRow napis2 = null;             DataSet DSSS = null;             for ( int n = 0, n &lt; licznikz n + + )             {                 napis6 = dss5.Tables [ "Event" ] . Rows [n ] ;                 using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                 {                     SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue (0) . ToString ( ) + "' ", conn) ;                     SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                     DSSS = new DataSet ();                     adapter.Fill ( DSSS , " Club ");                 }                 napis1 = dsss.Tables [" Club "] . Rows [0] ;                 using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                 {                     SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue ( 1). ToString ( ) + "' ", conn) ;                     SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                     DSSS = new DataSet ();                     adapter.Fill ( DSSS , " Club ");                 }                 napis2 = dsss.Tables [" Club "] . Rows [0] ;                 for (int i = 0; i &lt; dataSource.Count , i + + )                 {                     if ( dataSource [i] . NazwaLigi.Contains ( napis.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [i] . Gospodarze.Contains ( napis1.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [ i] . Goście.Contains ( napis2.ItemArray.GetValue (0) . ToString ( )))                     {                         dataSource3.Add ( dataSource [i] ) ;                     }                 }             }         }         private void sort3 ( )         {                 int count = 0 ;                 using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                 {                     SqlCommand command = new SqlCommand ( "select name from League where ( IdDyscypliny = (select IdDyscypliny from discipline where name = ' " + drzewo_dyscyplina + " ') AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' " + drzewo_kraj + "' ) ) ", conn) ;                     SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                     ds = new DataSet ();                     adapter.Fill (ds , "The League ");                 }                 count = ds.Tables [ "The League "] . Rows.Count ;                 DataRow caption = null;                 for (int k = 0 , k &lt; count; k + + )                 {                     caption = ds.Tables [ "The League "] . Rows [ k] ;                     licznikz int = 0;                     using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                     {                         SqlCommand command = new SqlCommand ( "select IdKlubu , IdKlubu2 from event where IdLigi = (select IdLigi from League where ( Name = ' " + napis.ItemArray.GetValue (0) . ToString ( ) + " ' AND IdDyscypliny = (select IdDyscypliny from discipline WHERE name = ' "+ drzewo_dyscyplina + " ') AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' "+ drzewo_kraj + " ') AND (Season = '2013 'OR Season = '2013 / 2014 ' ))) " , conn) ;                         SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                         dss5 = new DataSet ();                         adapter.Fill ( dss5 , "Event" ) ;                     }                     licznikz = dss5.Tables [ "Event" ] . Rows.Count ;                     DataRow napis6 = null;                     DataRow napis1 = null;                     DataRow napis2 = null;                     DataSet DSSS = null;                     for ( int n = 0, n &lt; licznikz n + + )                     {                         napis6 = dss5.Tables [ "Event" ] . Rows [n ] ;                         using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                         {                             SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue (0) . ToString ( ) + "' ", conn) ;                             SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                             DSSS = new DataSet ();                             adapter.Fill ( DSSS , " Club ");                         }                         napis1 = dsss.Tables [" Club "] . Rows [0] ;                         using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                         {                             SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue ( 1). ToString ( ) + "' ", conn) ;                             SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                             DSSS = new DataSet ();                             adapter.Fill ( DSSS , " Club ");                         }                         napis2 = dsss.Tables [" Club "] . Rows [0] ;                         for (int i = 0; i &lt; dataSource.Count , i + + )                         {                             if ( dataSource [i] . NazwaLigi.Contains ( napis.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [i] . Gospodarze.Contains ( napis1.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [ i] . Goście.Contains ( napis2.ItemArray.GetValue (0) . ToString ( )))                             {                                 dataSource3.Add ( dataSource [i] ) ;                             }                         }                     }                 }             }         private void sort4 ( )         {             DataSet dsx = null;             licznikx int = 0;             using ( SqlConnection CONNX = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )             {                 Poleceniex SqlCommand = new SqlCommand ( "select name from country where IdKontynentu = (select IdKontynentu from Continent where name = ' " + drzewo_kontynent + "' ) ", CONNX ) ;                 Adapterx SqlDataAdapter = new SqlDataAdapter ( poleceniex ) ;                 dsx = new DataSet ();                 adapterx.Fill ( dsx , "Country ");             }             licznikx = dsx.Tables [ "Country "] . Rows.Count ;             DataRow napisx = null;             for (int j = 0; j &lt; licznikx j + + )             {                 napisx = dsx.Tables [ "Country "] . Rows [i ] ;                 int count = 0 ;                 using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                 {                     SqlCommand command = new SqlCommand ( "select name from League where ( IdDyscypliny = (select IdDyscypliny from discipline where name = ' " + drzewo_dyscyplina + " ') AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' " + napisx.ItemArray.GetValue (0) . ToString ( ) + " ')) ", conn) ;                     SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                     ds = new DataSet ();                     adapter.Fill (ds , "The League ");                 }                 count = ds.Tables [ "The League "] . Rows.Count ;                 DataRow caption = null;                 for (int k = 0 , k &lt; count; k + + )                 {                     caption = ds.Tables [ "The League "] . Rows [ k] ;                     licznikz int = 0;                     using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                     {                         SqlCommand command = new SqlCommand ( "select IdKlubu , IdKlubu2 from event where IdLigi = (select IdLigi from League where ( Name = ' " + napis.ItemArray.GetValue (0) . ToString ( ) + " ' AND IdDyscypliny = (select IdDyscypliny from discipline WHERE name = ' "+ drzewo_dyscyplina + " ') AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' "+ napisx.ItemArray.GetValue (0) . ToString ( ) +" ') AND (Season = '2013 'OR season = '2013 / 2014 ' ))) " , conn) ;                         SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                         dss5 = new DataSet ();                         adapter.Fill ( dss5 , "Event" ) ;                     }                     licznikz = dss5.Tables [ "Event" ] . Rows.Count ;                     DataRow napis6 = null;                     DataRow napis1 = null;                     DataRow napis2 = null;                     DataSet DSSS = null;                     for ( int n = 0, n &lt; licznikz n + + )                     {                         napis6 = dss5.Tables [ "Event" ] . Rows [n ] ;                         using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                         {                             SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue (0) . ToString ( ) + "' ", conn) ;                             SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                             DSSS = new DataSet ();                             adapter.Fill ( DSSS , " Club ");                         }                         napis1 = dsss.Tables [" Club "] . Rows [0] ;                         using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                         {                             SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue ( 1). ToString ( ) + "' ", conn) ;                             SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                             DSSS = new DataSet ();                             adapter.Fill ( DSSS , " Club ");                         }                         napis2 = dsss.Tables [" Club "] . Rows [0] ;                         for (int i = 0; i &lt; dataSource.Count , i + + )                         {                             if ( dataSource [i] . NazwaLigi.Contains ( napis.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [i] . Gospodarze.Contains ( napis1.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [ i] . Goście.Contains ( napis2.ItemArray.GetValue (0) . ToString ( )))                             {                                 dataSource3.Add ( dataSource [i] ) ;                             }                         }                     }                 }             }         }         private void sort5 ( )         {             DataSet dsy = null;             liczniky int = 0;             using ( SqlConnection conny = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )             {                 Poleceniey SqlCommand = new SqlCommand ( "select name from Continent ", conny ) ;                 SqlDataAdapter adapter = new SqlDataAdapter ( poleceniey ) ;                 dsy = new DataSet ();                 adaptery.Fill ( dsy , " Continent ");             }             liczniky = dsy.Tables [" Continent "] . Rows.Count ;             DataRow subtitle = null;             for ( int l = 0, l &lt; liczniky , l + + )             {                 Subtitles = dsy.Tables [" Continent "] . Rows [l] ;                 DataSet dsx = null;                 licznikx int = 0;                 using ( SqlConnection CONNX = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                 {                     Poleceniex SqlCommand = new SqlCommand ( "select name from country where IdKontynentu = (select IdKontynentu from Continent where name = ' " + napisy.ItemArray.GetValue (0) . ToString ( ) + " ')" , CONNX ) ;                     Adapterx SqlDataAdapter = new SqlDataAdapter ( poleceniex ) ;                     dsx = new DataSet ();                     adapterx.Fill ( dsx , "Country ");                 }                 licznikx = dsx.Tables [ "Country "] . Rows.Count ;                 DataRow napisx = null;                 for (int j = 0; j &lt; licznikx j + + )                 {                     napisx = dsx.Tables [ "Country "] . Rows [i ] ;                     int count = 0 ;                     using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                     {                         SqlCommand command = new SqlCommand ( "select name from League where ( IdDyscypliny = (select IdDyscypliny from discipline where name = ' " + drzewo_dyscyplina + " ') AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' " + napisx.ItemArray.GetValue (0) . ToString ( ) + " ')) ", conn) ;                         SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                         ds = new DataSet ();                         adapter.Fill (ds , "The League ");                     }                     count = ds.Tables [ "The League "] . Rows.Count ;                     DataRow caption = null;                     for (int k = 0 , k &lt; count; k + + )                     {                         caption = ds.Tables [ "The League "] . Rows [ k] ;                         licznikz int = 0;                         using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                         {                             SqlCommand command = new SqlCommand ( "select IdKlubu , IdKlubu2 from event where IdLigi = (select IdLigi from League where ( Name = ' " + napis.ItemArray.GetValue (0) . ToString ( ) + " ' AND IdDyscypliny = (select IdDyscypliny from discipline WHERE name = ' "+ drzewo_dyscyplina + " ') AND IdKraju = (SELECT IdKraju FROM Country WHERE Name = ' "+ napisx.ItemArray.GetValue (0) . ToString ( ) +" ') AND (Season = '2013 'OR season = '2013 / 2014 ' ))) " , conn) ;                             SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                             dss5 = new DataSet ();                             adapter.Fill ( dss5 , "Event" ) ;                         }                         licznikz = dss5.Tables [ "Event" ] . Rows.Count ;                         DataRow napis6 = null;                         DataRow napis1 = null;                         DataRow napis2 = null;                         DataSet DSSS = null;                         for ( int n = 0, n &lt; licznikz n + + )                         {                             napis6 = dss5.Tables [ "Event" ] . Rows [n ] ;                             using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                             {                                 SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue (0) . ToString ( ) + "' ", conn) ;                                 SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                                 DSSS = new DataSet ();                                 adapter.Fill ( DSSS , " Club ");                             }                             napis1 = dsss.Tables [" Club "] . Rows [0] ;                             using ( SqlConnection conn = new SqlConnection ( "Data Source = ADAM_LAPTOP ; Integrated Security = true; Database = astruzik " ) )                             {                                 SqlCommand command = new SqlCommand ( "select name from Club where IdKlubu = ' " + napis6.ItemArray.GetValue ( 1). ToString ( ) + "' ", conn) ;                                 SqlDataAdapter adapter = new SqlDataAdapter ( command ) ;                                 DSSS = new DataSet ();                                 adapter.Fill ( DSSS , " Club ");                             }                             napis2 = dsss.Tables [" Club "] . Rows [0] ;                                                                           for (int i = 0; i &lt; dataSource.Count , i + + )                         {                             if ( dataSource [i] . NazwaLigi.Contains ( napis.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [i] . Gospodarze.Contains ( napis1.ItemArray.GetValue (0) . ToString ( ) ) &amp;&amp; dataSource [ i] . Goście.Contains ( napis2.ItemArray.GetValue (0) . ToString ( )))                             {                                 dataSource3.Add ( dataSource [i] ) ;                             }                         }                         }                     }                 }             }         } </code></pre> <p>dataSource3 is a list that is displayed at ZdarzeniaDataGrid DataSource is a list of sub-</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload