Search Results

Search found 3 results on 1 pages for 'user609511'.

Page 1/1 | 1 

  • C# Tupel group limitation

    - by user609511
    How can i controll the loop of Tupel Repeatation ? Someone has give me a hint about my algorithm. I modified a little bit his algorithm. int LimCol = Convert.ToInt32(LimitColis); result = oListTUP .GroupBy(x => x.Item1) .Select(g => new { Key = g.Key, Sum = g.Sum(x => x.Item2), Poids = g.Sum(x => x.Item3), }) .Select(p => new { Key = p.Key, Items = Enumerable.Repeat(LimCol , p.Sum / LimCol).Concat(Enumerable.Repeat(p.Sum % LimCol, 1)), CalculPoids = p.Poids / (Enumerable.Repeat(LimCol, p.Sum / LimCol).Concat(Enumerable.Repeat(p.Sum % LimCol, 1))).Count() }) .SelectMany(p => p.Items.Select(i => Tuple.Create(p.Key, i, p.CalculPoids))) .ToList(); foreach (var oItem in result) { Label1.Text += oItem.Item1 + "--" + oItem.Item2 + "--" + oItem.Item3 + "<br>"; } the result with LimCol = 3 as you can see i colored with red is the problem. i expected: 0452632--3--3,75 0452632--3--3,75 0452632--3--3,75 0452632--3--3,75 essai 49--3--79,00 essai 49--2--79,00 Thanks you in advance

    Read the article

  • SQL Update with row_number()

    - by user609511
    i m using SQL Server 2008 R2. i want to update my column CODE_DEST with increment number CODE_DEST RS_NOM null qsdf null sdfqsdfqsdf null qsdfqsdf what i want: CODE_DEST RS_NOM 1 qsdf 2 sdfqsdfqsdf 3 qsdfqsdf i have try this: update DESTINATAIRE_TEMP set CODE_DEST = TheId FROM (SELECT Row_Number() OVER (ORDER BY [RS_NOM]) as TheId from DESTINATAIRE_TEMP) not work because of ) and this With DESTINATAIRE_TEMP As ( SELECT ROW_NUMBER() OVER (ORDER BY [RS_NOM] DESC) AS RN FROM DESTINATAIRE_TEMP ) UPDATE DESTINATAIRE_TEMP SET CODE_DEST=RN because of union

    Read the article

  • LINQ to SQL Converter

    - by user609511
    How can I convert My LINQ to SQL ? i have this LINQ statement: int LimCol = Convert.ToInt32(LimitColis); result = oListTUP .GroupBy(x => new { x.Item1, x.Item2, x.Item3, x.Item4, x.Item5 }) .Select(g => new { Key = g.Key, Sum = g.Sum(x => x.Item6), Poids = g.Sum(x => x.Item7), }) .Select(p => new { Key = p.Key, Items = Enumerable.Repeat(LimCol, p.Sum / LimCol).Concat(Enumerable.Repeat(p.Sum % LimCol, p.Sum % LimCol > 0 ? 1 : 0)), CalculPoids = p.Poids / Enumerable.Repeat(LimCol, p.Sum / LimCol).Concat(Enumerable.Repeat(p.Sum % LimCol, p.Sum % LimCol > 0 ? 1 : 0)).Count() }) .SelectMany(p => p.Items.Select(i => Tuple.Create(p.Key.Item1, p.Key.Item2, p.Key.Item3, p.Key.Item4, p.Key.Item5, i, p.CalculPoids))) .ToList(); } It works well, but somehow want to push it and it become too complicated, so I want to convert it into Pure SQL. I have tried SQL Profiler and LinqPad, but neither shows me the SQL. How can I see the SQL code from My LINQ ? Thank you in advance.

    Read the article

1