码迷,mamicode.com
首页 > 其他好文 > 详细

程序从高版本降到2.0,数据集报错 TypedTableBase

时间:2015-06-25 11:48:40      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:

错误  命名空间“System.Data”中不存在类型或命名空间名称“TypedTableBase”(是缺少程序集引用吗?)

解决:

该错误出现在自动生成的XXX.Designer.cs里。

.NET 3.5 :

public partial class T_OPERATOR_WLDataTable : global::System.Data.TypedTableBase<T_OPERATOR_WLRow> 

要改成

.NET 2.0:

public partial class T_OPERATOR_WLDataTable : global::System.Data.DataTable, global::System.Collections.IEnumerable 

然后编译会出现另一个错误

错误 1 “DataTable”不实现接口成员“System.Collections.IEnumerable.GetEnumerator()”

继承接口加上下面这段就可以了

public System.Collections.IEnumerator GetEnumerator()
{
  return GetEnumerator();
}

重新编译后会自动进化成这样

[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
public virtual global::System.Collections.IEnumerator GetEnumerator() {
  return this.Rows.GetEnumerator();
}

 

程序从高版本降到2.0,数据集报错 TypedTableBase

标签:

原文地址:http://www.cnblogs.com/David-Huang/p/TypedTableBase.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!