I'm trying to save the values in database. But here I can able to save only once after executing. During second time it shows inner exception as "{"Duplicate entry '' for key 1"}"
Looks like you're assigning the same key to a new object. I mean maybe you're trying to Save a new object in the database with the same key/Id. If you're updating the object with Id/Key = 1 you should use an update command instead.
As Jonny Cundall said we need more information about your NHibernate mapping to see what you're doing...
Do this for you identity:
<!-- Identity mapping -->
<id name="Emp_Id">
<column name="Emp_Id" />
<generator class="native" />
</id>
Advice: do not use string as your data type for an identity column.
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.