none
Setting SQL int value to 0 is not updating in the column in the DB RRS feed

  • Question

  • I have an issue where an entry is not updating a column in the DB if the value is set to 0. The row is being updated as I attached an object and changed the Name column as well as setting the count column to 0 (it's currently set to 10). The name updated but the count stayed at 10. If I set the count to anything other than 0 it also gets updated...

    Any ideas?!

    Sunday, April 29, 2012 11:47 AM

All replies

  • Hi Ian_c221;

    Do you have any constraints on this column in the database?

      


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Sunday, April 29, 2012 12:52 PM
  • Hi Fernando,

    No there are no constraints, I can set the value to 0 using SQL Management Studio. I am at a loss here...

    Sunday, April 29, 2012 1:39 PM
  • Hi Ian_c221;

    Please post the class in question from the model. If you are using Database First it will be found in the ModelName.designer.cs file or if Code First the class you created and any configuration to that class. and the code you used to update the field.

     


    Fernando (MCSD)

    If a post answers your question, please click "Mark As Answer" on that post and "Mark as Helpful".

    Sunday, April 29, 2012 1:55 PM
  • Hi Ian_c221,

    Welcome to MSDN Forum.

    Have you solved the issue? If not, could you please post the code here?

    Best Regards


    Allen Li [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, May 2, 2012 2:56 AM
    Moderator