专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > .NET Framework

System.ArgumentException: Item has already been added. Key in dictionary: 'Id' Key being

发布时间:2011-06-23 14:39:13 文章来源:www.iduyao.cn 采编人员:星星草
System.ArgumentException: Item has already been added. Key in dictionary: 'Id' Key being added: 'Id'
public   partial   class   Send   :   System.Web.UI.Page
{
private   static   DataTable   addressDataTable;
protected   void   Page_Load(object   sender,   EventArgs   e)
  {
                if   (!IsPostBack)
                {  
                        if   (addressDataTable   ==   null)
                                curentAddressTable();
                        else
                                addressDataTable.Clear();
……

private   void   curentAddressTable()
        {
                addressDataTable   =   new   DataTable();
                addressDataTable.Clear();
                addressDataTable.Columns.Clear();
                addressDataTable.Columns.Add( "Id ");//System.ArgumentException:   Item   has   already   been   added.   Key   in   dictionary:   'Id '     Key   being   added:   'Id '
                addressDataTable.Columns.Add( "手机 ");
                addressDataTable.Columns.Add( "姓名 ");
        }


------解决方案--------------------
不要用Id作为column, table中有默认Id的column,换个名字吧
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: