Click here to Skip to main content
15,895,011 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
database view
SQL
CREATE view [dbo].[VsEFS] with schemabinding as
(
      select EfId ,EfAMaxMarks,EfCent,EfRollNo ,A.FsAdded ,A.FsMarks ,A.FsEfId,A.FsEsId
      from [dbo].ExamForms ,[dbo].FormSub A
       where EfId=FsEfId
 )
GO

CREATE UNIQUE CLUSTERED INDEX [IX_O] ON [dbo].[VsEFS] 
(
	[EfId] ASC,
	[FsEsId] ASC
)
WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO


In Controller I have written a code to update value of FsAdded :
IEnumerable<VsEF> vs = db.VsEFS.Where(c => c.EfId == 16714);
foreach (var t in vs)
           {
               if (t.FsEsId==5491)
               t.FsAdded = "45";
           } 

 db.SaveChanges();

but while updating values in database it gives an error like:
The property 'FsAdded' is part of the object's key information and cannot be modified.

database views are updatable from model?
any one can help?
Posted
Updated 23-Aug-13 19:28pm
v2
Comments
Jameel VM 23-Aug-13 7:20am    
where is the code for 'update'?
[no name] 2-Sep-13 7:24am    
share your model for VsEFS

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