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. Insert statement (please read again.)

Insert statement (please read again.)

Scheduled Pinned Locked Moved ASP.NET
databasehelp
4 Posts 3 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
    hahii
    wrote on last edited by
    #1

    have two tables. Roles and Users. In Roles I have three columns iID(PK), Role(varchar), Description(varchar). In User table I have columns ID(PK,FK), Username(varchar), Password(varchar), Role(int). First I fill data in Roles table then now I am trying to insert data in User table it is giving me following error. Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY constraint "FK_User_Role". The conflict occurred in database "DataFeed", table "dbo.Role", column 'Id'. The statement has been terminated.

    C C 3 Replies Last reply
    0
    • H hahii

      have two tables. Roles and Users. In Roles I have three columns iID(PK), Role(varchar), Description(varchar). In User table I have columns ID(PK,FK), Username(varchar), Password(varchar), Role(int). First I fill data in Roles table then now I am trying to insert data in User table it is giving me following error. Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY constraint "FK_User_Role". The conflict occurred in database "DataFeed", table "dbo.Role", column 'Id'. The statement has been terminated.

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The reason you're posting a ton of questions, is that you have no idea what you're doing. Add a book on SQL to your list. Do you know what this error means ? If not, you should NOT be working on database code. But, that's the point, isn't it ?

      Christian Graus Driven to the arms of OSX by Vista. Please read this[^] if you don't like the answer I gave to your question.

      1 Reply Last reply
      0
      • H hahii

        have two tables. Roles and Users. In Roles I have three columns iID(PK), Role(varchar), Description(varchar). In User table I have columns ID(PK,FK), Username(varchar), Password(varchar), Role(int). First I fill data in Roles table then now I am trying to insert data in User table it is giving me following error. Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY constraint "FK_User_Role". The conflict occurred in database "DataFeed", table "dbo.Role", column 'Id'. The statement has been terminated.

        C Offline
        C Offline
        Colin Angus Mackay
        wrote on last edited by
        #3

        I have read this and you have not asked a question. You have supplied a series of incomplete, random and contradictory statements. In one statement you say that in the table "Roles [you] have three columns iID(PK)...". However, the error message says the conflict is on "table "dbo.Role", column 'Id'." Please provide the CREATE TABLE statement for the Roles and Users tables, also provide the INSERT statement that failed.

        Man who stand on hill with mouth open wait long time for roast duck to drop in

        1 Reply Last reply
        0
        • H hahii

          have two tables. Roles and Users. In Roles I have three columns iID(PK), Role(varchar), Description(varchar). In User table I have columns ID(PK,FK), Username(varchar), Password(varchar), Role(int). First I fill data in Roles table then now I am trying to insert data in User table it is giving me following error. Msg 547, Level 16, State 0, Line 1 The INSERT statement conflicted with the FOREIGN KEY constraint "FK_User_Role". The conflict occurred in database "DataFeed", table "dbo.Role", column 'Id'. The statement has been terminated.

          C Offline
          C Offline
          Colin Angus Mackay
          wrote on last edited by
          #4

          Just realised I'm in the ASP.NET forum - Why are you asking this here? It is a database question!

          Man who stand on hill with mouth open wait long time for roast duck to drop in

          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