I have table CustomerPurchase and equivalent data class DBML file also created. In this, DBML class, I have added my Custom field ' TotalAmount ' for calculations to show in the Listivew. but InsertOnSubmit(), it is throwing an error as Invalid column name ' TotalAmount '.
How can I exclude this user defined field while submit?
If you look inside the dbml
file, you can see it is generate partial classes
, so you can some partial classes to your entities, and create other properties, like TotalAmount
you need. There you can access other properties and make calculated property, for sample:
namespace YourEntityNameSpace
{
public partial class CustomerPurchase
{
public double TotalAmount
{
get
{
// your code goes here to calculate, for sample:
return UnitPrice * Amount;
}
}
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.