string strcon = "server=sxsoft2;database=wu;uid=sa;pwd=11";
        string strsum = "select null as name,null as text,null as time,null as id,sum(money) as money from tableGet";
        string strall = "select name,text,time,id,money from tableGet";
        public Form1()
        {
            InitializeComponent();
            DataTable table = new DataTable();
            table = ser.getDataSource(strsum);
            MessageBox.Show(table.Rows.Count.ToString());        }
按道理应该有一行数据写进去的,但是这边报错。

解决方案 »

  1.   

    我用osql直接打出来可以看到这个不为空啊.难道这个也是空?
      

  2.   

    strsum放到查询分析器里执行下看看
      

  3.   

    你跟踪进ser.getDataSource看看
      
    *****************************************************************************
    签名档: http://feiyun0112.cnblogs.com/
      

  4.   


    这个只是一个select查询返回datatable。我用了很多了都没错。
      

  5.   

    您说的是我2楼做的东西吗?这个代码我直接在cmd中的osql中运行过了,没有问题。
      

  6.   

    你那不明显都返回null了么?为什么要判断count>1?
    ==1的时候不就返回null了么?
      

  7.   

    版主说了if(dst.Tables[0].Rows.Count>=1) //源代码条件>1 把1条数据的情况给排除了
    {
        return dst.Tables[0];
    }
    else
    {
        return null;
    }