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. General Programming
  3. LINQ
  4. update on "index" [solved]

update on "index" [solved]

Scheduled Pinned Locked Moved LINQ
helpquestiondatabaseannouncement
1 Posts 1 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.
  • L Offline
    L Offline
    LiYS
    wrote on last edited by
    #1

    Hi all, I was trying to add a row to a table by "InsertOnSubmit" with the first column "id" having "Is Identity = Yes" The problem is that I got an error saying "Cannot insert explicit value for identity column in table 'Polls' when IDENTITY_INSERT is set to OFF." But I only update the two columns follwing the "id" column and why I'm getting this error? Table sqs = ctx.GetTable(); SurveyQuestion sq = new SurveyQuestion(); // "sq.Id" did get update with '0' on the ctr but // I didn't explicitly doing something like "sq.Id = n", that's the problem? sq.Question = "SurveyQue"; sq.Active = true; sqs.InsertOnSubmit(sq); ctx.SubmitChanges(); Update: The question boils down to how could I exlucde certain field from updating when calling "InsertOnSubmit". update: Add "IsDbGenerated = true" to the mapping column will do the trick. Thanks,


    modified on Thursday, November 13, 2008 9:17 PM

    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