我要查DataSet中一个字段的所有值!这个字段下所有值的个数如何得到!要源码谢谢

解决方案 »

  1.   

    DataSet myds =..;
    string str1 = myds.tables[0].rows[i][j].tostring();
      

  2.   

    //取一列的值
    for(int j=0;j<DataSet.Tables[0].Rows.Count;j++)
    {
        string r+= DataSet.Tables[0].Rows[j]["列名"].ToString()+"|";
    }
    return r;//计算个数
    int i= DataSet.Tables[0].Rows.Count
      

  3.   

    //取一列的值
    for(int j=0;j<DataSet.Tables[0].Rows.Count;j++)
    {
        string r+= DataSet.Tables[0].Rows[j]["列名"].ToString()+"|";
    }
    return r;//计算个数
    int i= DataSet.Tables[0].Rows.Count1 DataSet是关键字不能这样用2 计算个数得到是数据集合的个数,而不是字段值的个数