467,173 Members | 1,343 Online
Bytes | Developer Community
Ask Question

Home New Posts Topics Members FAQ

Post your question to a community of 467,173 developers. It's quick & easy.

LinQ. update column with auto generated value

The problem I'm coming across now is that I can't update such a column,
because I have set the auto generated value to true, and LINQ won't let me
change such a value, a la "System.InvalidOperationException: Value of member
'Activated' of an object of type 'Customers' changed. A member that is
computed or generated by the database cannot be changed."

This is fine for identity fields, but the field I'm updating is a bit that
starts off FALSE on every record, and is later updated to TRUE. How can I
resolve this, so that when inserting records I don't have to include this
column, yet when updating records I can change its value?
--
Carles Ferrer
Jul 22 '08 #1
  • viewed: 3225
Share:
3 Replies
Hello Carles,

The symptom sounds very similar to the problem described in the codeproject
article:
http://www.codeproject.com/KB/linq/S...ultValues.aspx
(see the part of the author set the IsDbGenerated property to true)

The workaround is to hook the Updating and Inserting events of
LinqDataSource, and reset the LINQ object's default values for insert and
update.

Please have a look and let me know whether the article is helpful to you or
not. If you have any other concerns or questions, DON'T hesitate to tell me.

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscripti...ult.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscripti...t/default.aspx.
==================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 23 '08 #2
Hello Carles

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Jul 28 '08 #3
Hello Jialiang,

Thanks for response. All perfect,

Bye!!
--
Carles Ferrer
MCTS
..NET 2005 and DB developer
""Jialiang Ge [MSFT]"" wrote:
Hello Carles

I am writing to check the status of the issue on your side. Would you mind
letting me know the result of the suggestions? If you need further
assistance, feel free to let me know. I will be more than happy to be of
assistance.

Have a great day!

Regards,
Jialiang Ge (ji****@online.microsoft.com, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
ms****@microsoft.com.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

Aug 5 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by Ornette | last post: by
3 posts views Thread by =?Utf-8?B?THVib21pcg==?= | last post: by
3 posts views Thread by Marc S | last post: by
15 posts views Thread by shapper | last post: by
4 posts views Thread by =?Utf-8?B?RXJpYyBGYWxza2Vu?= | last post: by
14 posts views Thread by thj | last post: by
3 posts views Thread by =?Utf-8?B?UGF1bCBQcmV3ZXR0?= | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.