DataSource error: “Cannot Bind to property or Column”

前端 未结 5 1557
庸人自扰
庸人自扰 2020-12-20 16:46

I\'m working on a database in C# when I hit the display button I get an error:

Error:
Cannot bind to the property or column LastName on the Data

5条回答
  •  借酒劲吻你
    2020-12-20 16:48

    I had the same problem and it was because the columns in both my tables had the same column names. For example:

    1. My database name was Assets;
    2. The first table name was Property and the second table name was Plants;
    3. The first column names in both the tables were asset_number; It gave the error you describe above, but mine said asset_number.

    Solution: I changed the column names in my table Plants to asset_number1 and then it had no problem. (I did have to delete all my old columns in Plants to redo the new columns.)

提交回复
热议问题