Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • vijay 129 posts 152 karma points
    Dec 26, 2009 @ 06:38
    vijay
    0

    Error occured while creating User using Usercontrol?

    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoUser2app_umbracoUser". The conflict occurred in database "UmbracoCMS", table "dbo.umbracoUser", column 'id'.<br>The statement has been terminated. body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; }

    Hi all,

     

    I am getting the following error while creating the user using my .net usr control.Any one please guide me.

     

    vijay.

    Server Error in '/' Application.


    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoUser2app_umbracoUser". The conflict occurred in database "UmbracoCMS", table "dbo.umbracoUser", column 'id'.
    The statement has been terminated.

    Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

    Exception Details: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoUser2app_umbracoUser". The conflict occurred in database "UmbracoCMS", table "dbo.umbracoUser", column 'id'.
    The statement has been terminated.

    Source Error:

    An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.


    Stack Trace:

    [SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_umbracoUser2app_umbracoUser". The conflict occurred in database "UmbracoCMS", table "dbo.umbracoUser", column 'id'.
    The statement has been terminated.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +857546
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +735158
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +149
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +886
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
       System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe) +415
       System.Data.SqlClient.SqlCommand.ExecuteNonQuery() +135
       Microsoft.ApplicationBlocks.Data.SqlHelper.ExecuteNonQuery(String connectionString, CommandType commandType, String commandText, SqlParameter[] commandParameters) +106
       umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteNonQuery(String commandText, SqlParameter[] parameters) +21
       umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +53
    
    [SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteNonQuery]
       umbraco.DataLayer.SqlHelper`1.ExecuteNonQuery(String commandText, IParameter[] parameters) +137
       umbraco.BusinessLogic.User.addApplication(String AppAlias) +145
       Createuser.btn_CreateUser_Click(Object sender, EventArgs e) +86
       System.Web.UI.WebControls.Button.OnClick(EventArgs e) +105
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +107
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +7
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +11
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +33
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +5102
    



    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42

  • Richard Soeteman 4046 posts 12899 karma points MVP 2x
    Dec 26, 2009 @ 12:28
    Richard Soeteman
    0

    How did you create the new user?

  • vijay 129 posts 152 karma points
    Dec 31, 2009 @ 06:42
    vijay
    0

    Hi Richard,

    I am creating user using following code

     UserType ut = UserType.GetUserType(3);
            User.MakeNew("arun", "salgaonkar", "tushar", ut);
            User u = new User("tushar");

            u.addApplication("settings");
           
            u.Save();

    Then above error comes but user is created.

    ---vijay.

  • Sebastiaan Janssen 5060 posts 15522 karma points MVP admin hq
    Jan 02, 2010 @ 13:34
    Sebastiaan Janssen
    0

    It looks like you do not check if the user already exist. So of course you would get this error.

    You can check if the user exists like so:

    if (Member.GetMemberFromEmail("[email protected]") == null) {
      //create the user
    }
  • vijay 129 posts 152 karma points
    Jan 02, 2010 @ 14:07
    vijay
    0

    thanks for your reply

    ----vijay.

Please Sign in or register to post replies

Write your reply to:

Draft