Note that there are some explanatory texts on larger screens.

plurals
  1. POoptimising linq queries to incres
    primarykey
    data
    text
    <p>I have the the below linq queries searching a the same data table and was wondering if it would be possible to make one search and do the below for loops to add data to to the same variables so that it can make the system faster.</p> <pre><code>var sort = configurationData.AsEnumerable().Where(sorts =&gt; sorts.Field&lt;String&gt;("QuestionStartText") == question &amp;&amp; sorts.Field&lt;String&gt;("slideNo") == Convert.ToString(slideNumber) ) .Select(sorted =&gt; sorted.Field&lt;String&gt;("SortByColumn")).Distinct().AsParallel(); var rowNeedAfterSort = configurationData.AsEnumerable().Where(sorts =&gt; sorts.Field&lt;String&gt;("QuestionStartText") == question &amp;&amp; sorts.Field&lt;String&gt;("slideNo") == Convert.ToString(slideNumber)) .Select(sorted =&gt; sorted.Field&lt;String&gt;("NoOfRows")).Distinct().AsParallel(); var indexs = configurationData.AsEnumerable().Where(sorts =&gt; sorts.Field&lt;String&gt;("QuestionStartText") == question &amp;&amp; sorts.Field&lt;String&gt;("slideNo") == Convert.ToString(slideNumber)) .Select(sorted =&gt; sorted.Field&lt;String&gt;("ColumnInExcel")).Distinct().AsParallel(); int p = 0; int chartValue = 0; foreach (string inedcies in indexs) { if (inedcies != null) { if (!inedcies.ToUpper().Equals("NULL")) { if (inedcies.Contains(',')) { Array.Clear(valuesUsed, 0, valuesUsed.Length); string[] index = inedcies.Split(','); foreach (string a in index) { valuesUsed[p] = Convert.ToInt32(a); p++; } } else if (inedcies.Equals("7")) { Array.Clear(valuesUsed, 0, valuesUsed.Length); valuesUsed[p] = Convert.ToInt32(inedcies); } else { chartValue = Convert.ToInt32(inedcies); } } } } foreach (string sortedint in sort) { if (sortedint != null) { if (!sortedint.ToUpper().Equals("NULL")) { SortData2(sortedint); sortedData = "true"; } } } foreach (string rows in rowNeedAfterSort) { if (rows != null) { if (!rows.ToUpper().Equals("NULL")) { string[] values = rows.Split(' '); rowCount = Convert.ToInt32(values[1]); } } } </code></pre>
    singulars
    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