DataRow的构造函数是私有的?
可以这样么DataRow dr = dt.NewRow()

解决方案 »

  1.   

    DataRow是数据表里的一行记录,所以必须有表头(即字段信息)才能创建。你直接new一个,没有表头信息,肯定是不行的。
    可以用dt.NewRow(),因为dt里包含表头信息,系统知道如何创建记录。
      

  2.   

    DataRow的声明:protected internal DataRow(
    DataRowBuilder builder
    )
    解释:This API supports the .NET Framework infrastructure and is not intended to be used directly from your code.
    Initializes a new instance of the DataRow. Constructs a row from the builder. Only for internal usage..参考:
    http://msdn.microsoft.com/en-us/library/system.data.datarow.datarow(v=vs.110).aspx