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,换个名字吧