2009-04-01 11:04
col1   col2
53    0
48    1
54    2
48    3
42    4
36    5
35    6
35    7
29   8
29   9
30   10
23     11
23    12
23 13
23    14
23    15
18    16
20      17
18     18
 18      19
  18     20
  17      21
  18      22
  19     23
   14   24 
   10  25
12      26
  13     27
  14      28
  13        29
 13           30
15             31
 16            32
   8           33
  15           34
   15          35
    8        36
     8       37
     8        38
      8         39 
     9        40 

解决方案 »

  1.   

    select sum(co11) from Tb
      

  2.   

    int sum = 0;
    foreach (int x in col1)
    {
      sum += x;
    }
    System.Console.WriteLine(sum);
      

  3.   

    下面是我自己出题,自己解答   共计  524 贴,我是否可以出师了??
    using System;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;
    using System.Text.RegularExpressions;public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            计算();    }
        void 计算()
        {
            string strInput = @"53    0
    48    1
    54    2
    48    3
    42    4
    36    5
    35    6
    35    7
    29  8
    29  9
    30  10
    23    11
    23    12
    23 13
    23    14
    23    15
    18    16
    20      17
    18    18
    18      19
      18    20
      17      21
      18      22
      19    23
      14  24
      10  25
    12      26
      13    27
      14      28
      13        29
    13          30
    15            31
    16            32
      8          33
      15          34
      15          35
        8        36
        8      37
        8        38
          8        39
        9        40 ";
            int sum = 0;
            Regex regex = new Regex(@"\r\n");
            foreach (var item in regex.Split(strInput))
            {
                Regex _regex = new Regex(@"\s+");
                int i = 0;
                foreach (var _item in _regex.Split(item))
                {
                    if (i % 2 != 0)
                    {
                        if (_item == "")
                        {
                            continue;
                        }
                        sum += Convert.ToInt32(_item);
                    }
                    i++;
                }        }
        }}
      

  4.   

    看了半天才明白,你的标题是∑Col1太纠结了
      

  5.   

    以后你和老大交流业务,求和就直说求和千万别说的英译否则小心被老大一脚K出公司PS:多谢大角牛断贴