Note that there are some explanatory texts on larger screens.

plurals
  1. POQuery inside a thread
    primarykey
    data
    text
    <p>I have 3 comboboxes that are loaded with data from LINQ queries on page load. The problem is that queries contain so much data that it causes Internet Explorer to stop responding for a bit more than a minute.</p> <p>As there are 3 queries my idea is to put them in 3 different threads, but the problem is at the end the only thing I get is the error saying: "Both DataSource and DataSourceID are defined on 'cbOrganizator'. Remove one definition."</p> <p>cbOrganizator is a combobox.</p> <p>Here is the code:</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { Bind(); } public void Osobe() { PravosudnaAkademijaEntities db = new PravosudnaAkademijaEntities(); var osoba = from o in db.osobas orderby o.osoba_prezime select new { o.osoba_id, imePrezime = o.osoba_prezime + " " + o.osoba_ime + " | " + o.tijelo.tijelo_naziv + " | " + o.radno_mjesto.rm_naziv_m }; cbPolaznik.DataSource = osoba; cbPolaznik.DataTextField = "imePrezime"; cbPolaznik.DataValueField = "osoba_id"; cbPolaznik.DataBind(); cbPolaznik.Items.Insert(0, " "); cbPredavac.DataSource = osoba; cbPredavac.DataTextField = "imePrezime"; cbPredavac.DataValueField = "osoba_id"; cbPredavac.DataBind(); cbPredavac.Items.Insert(0, " "); cbAOM.DataSource = osoba; cbAOM.DataTextField = "imePrezime"; cbAOM.DataValueField = "osoba_id"; cbAOM.DataBind(); cbAOM.Items.Insert(0, " "); } public void Tijela() { PravosudnaAkademijaEntities db = new PravosudnaAkademijaEntities(); var tijelo = from t in db.tijeloes orderby t.tijelo_naziv select new { t.tijelo_id, sve = t.tijelo_naziv + " | " + t.mjesto.zupanija_drzava.zupanija_naziv }; cbOrganizator.DataSource = tijelo; cbOrganizator.DataTextField = "sve"; cbOrganizator.DataValueField = "tijelo_id"; cbOrganizator.DataBind(); cbOrganizator.Items.Insert(0, " "); } public void Bind() { Thread tOsobe = new Thread(Osobe); tOsobe.Start(); Thread tTijela = new Thread(Tijela); tTijela.Start(); } </code></pre> <p>I don't know what's wrong so any help would be appreciated. The primary idea is to separate queries into threads so if my approach is wrong please let me know.</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.
 

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