Click here to Skip to main content
15,885,028 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hii,

Previously i had table and i set a default constrint to one of my column .

so , if not provided in linq class , then null was setting by default even though i set my default value to 4 in sql table,

Then i chnaged the property of that column from dbml , Set autogenrate to true .. and it was working..

now the problem is .. from other method when i try to give some other value for that column ...


it is throwing an error ..

A member that is computed or generated by the database cannot be changed.

i want to use default value when not prvided and my value when procvided it should get updated
Posted
Updated 24-Jul-14 0:30am
v2
Comments
[no name] 24-Jul-14 8:45am    
If the value is autogenerated then there is always be a value in that column. Hence the name. "autogenerated". You trying to set a value for the column makes no sense.
Torakami 25-Jul-14 2:37am    
yes , i understand your point .. but say for example my requirement is .. i have column marital status ..

and there is many ways to create employee ..

two ways .. one manually filling the form .. other is importing excel sheet ..

now .. when i import via excel i am not providing option to fill marital status .. so by default it should set marital status to 4 . thats y i used default constrint .. and make autogenrate to true .. till herer its working ..

Now at the time of filling the form , i have the drop down to fill marital status .. so this point i am proving vale .. so it should work too ,... but not working ...
[no name] 25-Jul-14 7:27am    
Not only does that not make any sense, it is irrelevant. "not working" does not mean anything to anyone but you.
Torakami 25-Jul-14 8:29am    
I read it on Internet , and people say it should work , it is a bug in linq to sql.

I have this type of scenrios when i want to set default as well if i am not passing the value . and ehenver i am passing it should take that value when i set default constrint to my table column .

Other alternative is to pass the value all the time , but in this case there is no use of Default constrint /
[no name] 25-Jul-14 10:58am    
Okay.... whatever. I am not going to waste anymore of my time trying to figure out whatever it is that you are talking about.

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