locked
Can not post the ads at all! RRS feed

  • Question

  • User-1329334484 posted
     After trying to post an add I got this error:

    Server Error in '/Classifieds1' Application.

    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Ads_Members". The conflict occurred in database "C:\DOCUMENTS AND SETTINGS\RAFAL\MY DOCUMENTS\VISUAL STUDIO 2005\WEBSITES\CLASSIFIEDS1\APP_DATA\CLASSIFIEDSDB.MDF", table "dbo.Members", 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_Ads_Members". The conflict occurred in database "C:\DOCUMENTS AND SETTINGS\RAFAL\MY DOCUMENTS\VISUAL STUDIO 2005\WEBSITES\CLASSIFIEDS1\APP_DATA\CLASSIFIEDSDB.MDF", table "dbo.Members", column 'Id'.
    The statement has been terminated.

    Source Error:

    Line 2114:            object returnValue;
    Line 2115:            try {
    Line 2116:                returnValue = command.ExecuteScalar();
    Line 2117:            }
    Line 2118:            finally {

    Source File: c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\classifieds1\c30b7c00\471438b0\App_Code.dmzl1qvi.15.cs    Line: 2116

    Stack Trace:

    [SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Ads_Members". The conflict occurred in database "C:\DOCUMENTS AND SETTINGS\RAFAL\MY DOCUMENTS\VISUAL STUDIO 2005\WEBSITES\CLASSIFIEDS1\APP_DATA\CLASSIFIEDSDB.MDF", table "dbo.Members", column 'Id'.
    The statement has been terminated.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +95
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +82
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +346
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +3244
       System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +52
       System.Data.SqlClient.SqlDataReader.get_MetaData() +130
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +371
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +1121
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +334
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +45
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +161
       AdsDataComponentTableAdapters.AdsDataAdapter.InsertAd(Int32 MemberId, Int32 CategoryId, String Title, String Description, String URL, Decimal Price, String Location, Nullable`1 ExpirationDate, DateTime DateCreated, Nullable`1 DateApproved, Int32 NumViews, Int32 NumResponses, Int32 AdLevel, Int32 AdStatus, Int32 AdType) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\classifieds1\c30b7c00\471438b0\App_Code.dmzl1qvi.15.cs:2116
       AspNet.StarterKits.Classifieds.BusinessLogicLayer.AdsDB.InsertAd(Int32 memberId, Int32 categoryId, String title, String description, String url, Decimal price, String location, Int32 numDaysActive, AdLevel adLevel, AdStatus adStatus, AdType adType) in c:\Documents and Settings\RAFAL\My Documents\Visual Studio 2005\WebSites\Classifieds1\App_Code\BLL\Ads.cs:104
       PostAd_aspx.PostAdWizard_FinishButtonClick(Object sender, WizardNavigationEventArgs e) in c:\Documents and Settings\RAFAL\My Documents\Visual Studio 2005\WebSites\Classifieds1\PostAd.aspx.cs:76
       System.Web.UI.WebControls.Wizard.OnFinishButtonClick(WizardNavigationEventArgs e) +104
       System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +1084
       System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +39
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +56
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +107
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +177
       System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +31
       System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +32
       System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +72
       System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3839
    


    Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42
    <!-- [SqlException]: The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Ads_Members". The conflict occurred in database "C:\DOCUMENTS AND SETTINGS\RAFAL\MY DOCUMENTS\VISUAL STUDIO 2005\WEBSITES\CLASSIFIEDS1\APP_DATA\CLASSIFIEDSDB.MDF", table "dbo.Members", column 'Id'. The statement has been terminated. at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) at System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) at System.Data.SqlClient.SqlDataReader.ConsumeMetaData() at System.Data.SqlClient.SqlDataReader.get_MetaData() at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) at System.Data.SqlClient.SqlCommand.ExecuteScalar() at AdsDataComponentTableAdapters.AdsDataAdapter.InsertAd(Int32 MemberId, Int32 CategoryId, String Title, String Description, String URL, Decimal Price, String Location, Nullable`1 ExpirationDate, DateTime DateCreated, Nullable`1 DateApproved, Int32 NumViews, Int32 NumResponses, Int32 AdLevel, Int32 AdStatus, Int32 AdType) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\classifieds1\c30b7c00\471438b0\App_Code.dmzl1qvi.15.cs:line 2116 at AspNet.StarterKits.Classifieds.BusinessLogicLayer.AdsDB.InsertAd(Int32 memberId, Int32 categoryId, String title, String description, String url, Decimal price, String location, Int32 numDaysActive, AdLevel adLevel, AdStatus adStatus, AdType adType) in c:\Documents and Settings\RAFAL\My Documents\Visual Studio 2005\WebSites\Classifieds1\App_Code\BLL\Ads.cs:line 104 at PostAd_aspx.PostAdWizard_FinishButtonClick(Object sender, WizardNavigationEventArgs e) in c:\Documents and Settings\RAFAL\My Documents\Visual Studio 2005\WebSites\Classifieds1\PostAd.aspx.cs:line 76 at System.Web.UI.WebControls.Wizard.OnFinishButtonClick(WizardNavigationEventArgs e) at System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) at System.Web.UI.WebControls.Wizard.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) at System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) at System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) [HttpUnhandledException]: Exception of type 'System.Web.HttpUnhandledException' was thrown. at System.Web.UI.Page.HandleError(Exception e) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) at System.Web.UI.Page.ProcessRequest() at System.Web.UI.Page.ProcessRequestWithNoAssert(HttpContext context) at System.Web.UI.Page.ProcessRequest(HttpContext context) at ASP._postad_aspx.ProcessRequest(HttpContext context) in c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\classifieds1\c30b7c00\471438b0\App_Web_5tbtkafm.18.cs:line 0 at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) -->
    Thursday, June 1, 2006 1:29 PM

All replies

  • User-1329334484 posted
    Ok, i have figured it out. Seems that my members table was not in synch with aspnet table. I have created new user via the app interface and now it works.
    Thursday, June 1, 2006 1:38 PM
  • User1030710855 posted

    Newbie alert!

    You say..."I have created new user via the app interface and now it works." 

     

    How you do that.

    Thursday, March 11, 2010 9:19 AM
  • User730446648 posted

    There's two databases.

    If you create a user from visual studio or visual web developer asp.net tool it creates the user in only the mermber database.

    But the corect way is to register a user from the site's register.aspx page.

    That creates the user in both databases, and that's why he was getting the error above.

    The user did not have a specified id to cross reference.

     

    So if you use visual web developer or visual studio, just use the solution explorer to open register.aspx, right click, choose view in browser, and create your user.

     

    Good Luck

     

    Saturday, March 13, 2010 1:02 AM
  • User1030710855 posted

     

    When I "solution explorer to open register.aspx, right click, choose view in browser, and create your user." I get the following error. I have tried different passwords and filled in all fields.

     

    Error: "The password provided is invalid. Please enter a valid password . Acceptable passwords are at least 7 characters long and contain at least 1 non-alphanumeric character. "

    What free web hosting website can I use to test my classifieds adds? Any ideas. (Not aspspider.com, Cant upload there, silly error and no answer from support)

    Thanks for your help.

    Friday, March 19, 2010 6:53 AM
  • User1030710855 posted

    Solution:

    After using asp.net configuration. I created a administrator, then a user (myself), and using alphanumeric in my password (stupid that I missed that everytime it told me), then applying admin to the user.

    Still would like a test hosting site.

    Friday, March 19, 2010 7:46 AM
  • User320966101 posted

    The problem is that the very first ad you post for the first member of your site will have a member ID of "0" The classified members DB does not like a number less than one.  I created a dummy members account then used the next account as my admin account.

    Thursday, February 27, 2014 1:26 AM
  • User320966101 posted

    Simply change Defaut Value="0" for Member Id to "1" in Web.config file

    Thursday, February 27, 2014 1:28 AM