Click here to Skip to main content
15,881,424 members
Please Sign up or sign in to vote.
1.33/5 (2 votes)
I would to insert data from my controller to table customer which have a foreign key from active_customer, no_peserta is the foreign key which refer to active_customer table its my code
C#
var cus = new Customer
                              {


                                  no_peserta =17,
                                  nama_customer=nama,
                                  no_ktp=noktp,
                                  no_hp=nohp,
                                  tanggal_lahir=tgllahir
                              };
                              context.Customer.Add(cus);
                              context.SaveChanges();

but till now its still not work .If you have solution for this please tell me
Posted
Comments
Suket shah 20-Aug-15 1:31am    
From your question i could not get it. can you please tell me what exact error you get.so it would help to resolve.
Rijen Juni 20-Aug-15 1:44am    
An exception of type 'System.Data.Entity.Infrastructure.DbUpdateException' occurred in EntityFramework.dll but was not handled in user code

Additional information: Unable to update the EntitySet 'Customer' because it has a DefiningQuery and no <insertfunction> element exists in the <modificationfunctionmapping> element to support the current operation.
Suket shah 20-Aug-15 1:54am    
Please visit below link

http://stackoverflow.com/questions/19424058/system-data-entity-infrastructure-dbupdateexception-occurred-in-entityframewor

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900