1-888-365-2779
+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Cannot insert the value NULL into column 'Id'

Cannot insert the value NULL into column 'Id'

3 posts, 0 answered
  1. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    19 Jun 2009
    Link to this post

    After watching the great webinar about creating your own modules. I have tried the code out in my own system. First, i used the code from the sitefinitywatch web site. It worked like a dream.

    Then i tried to create my own module based on that code. Starting with a simplified version of it. Just one table with an ID and a Name.

    I am encountering a strange error when tyrying to add a new item.

    Cannot insert the value NULL into column 'Id', table 'testProject.dbo.test_Restaurants'; column does not allow nulls. INSERT fails.

    I have the autogenerate of id set to true, like this:

     

    [

    Column(Storage="_Id", DbType="UniqueIdentifier NOT NULL", IsPrimaryKey=true, IsDbGenerated=true)]

    So it should work. Any idea what it could be?

  2. Andrew
    Andrew avatar
    202 posts
    Registered:
    05 Jun 2009
    19 Jun 2009
    Link to this post
    Oh well.

    I take it back. It's my own fault.

    I wrote the sql script wrong. The table was not correctly formated.

    It's a bit late here almost 3 in the morning.

    Please ignore the post above. It's all solved now.
  3. Georgi
    Georgi avatar
    3583 posts
    Registered:
    28 Oct 2016
    19 Jun 2009
    Link to this post
    Hi Andrew,

    Thank you for the follow up. We are glad you managed to fix the problem.

    Don't hesitate to contact us if you have other questions.

    Greetings,
    Georgi
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Check out the tips for optimizing your support resource searches.
Register for webinar
3 posts, 0 answered