Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. ASP.NET
  4. How i can set IDENTITY_INSERT to ON in "LINQ to SQL" ?

How i can set IDENTITY_INSERT to ON in "LINQ to SQL" ?

Scheduled Pinned Locked Moved ASP.NET
csharpquestionasp-netdatabaselinq
6 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    humais
    wrote on last edited by
    #1

    i'm getting an error that "Cannot insert explicit value for identity column in table 'Comment' when IDENTITY_INSERT is set to OFF" i'm using "LINQ to SQL" in ASP.NET so how can i set IDENTITY_INSERT to ON? :^)

    T V B 3 Replies Last reply
    0
    • H humais

      i'm getting an error that "Cannot insert explicit value for identity column in table 'Comment' when IDENTITY_INSERT is set to OFF" i'm using "LINQ to SQL" in ASP.NET so how can i set IDENTITY_INSERT to ON? :^)

      T Offline
      T Offline
      TheGreatAndPowerfulOz
      wrote on last edited by
      #2

      use a stored procedure

      "If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams "Let me get this straight. You know her. She knows you. But she wants to eat him. And everybody's okay with this?"

      A 1 Reply Last reply
      0
      • H humais

        i'm getting an error that "Cannot insert explicit value for identity column in table 'Comment' when IDENTITY_INSERT is set to OFF" i'm using "LINQ to SQL" in ASP.NET so how can i set IDENTITY_INSERT to ON? :^)

        V Offline
        V Offline
        Vika Dev
        wrote on last edited by
        #3

        Why are you trying to insert an identity value? These are usually incremented automatically when a row is inserted into the DB and inserting your own value could cause a duplication in this column. You can open the table in Management Studio and turn off the indentity property for the column. Mike

        H 1 Reply Last reply
        0
        • H humais

          i'm getting an error that "Cannot insert explicit value for identity column in table 'Comment' when IDENTITY_INSERT is set to OFF" i'm using "LINQ to SQL" in ASP.NET so how can i set IDENTITY_INSERT to ON? :^)

          B Offline
          B Offline
          Bryian Tan
          wrote on last edited by
          #4

          hello, This thread might help IDENTITY_INSERT and linq[^]

          1 Reply Last reply
          0
          • V Vika Dev

            Why are you trying to insert an identity value? These are usually incremented automatically when a row is inserted into the DB and inserting your own value could cause a duplication in this column. You can open the table in Management Studio and turn off the indentity property for the column. Mike

            H Offline
            H Offline
            humais
            wrote on last edited by
            #5

            i'm using BlogID as primary key in Blog table & as a foreign key in Comment table.i'm trying to save BlogID manually in comment table from Query String in comment page.Tell me how i can do it? :confused:

            1 Reply Last reply
            0
            • T TheGreatAndPowerfulOz

              use a stored procedure

              "If your actions inspire others to dream more, learn more, do more and become more, you are a leader." - John Quincy Adams "Let me get this straight. You know her. She knows you. But she wants to eat him. And everybody's okay with this?"

              A Offline
              A Offline
              Ali Al Omairi Abu AlHassan
              wrote on last edited by
              #6

              How ?

              Help people,so poeple can help you.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups