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