Error When I Submit New Add in Classifieds Starter Kit

Discussion in 'ASP.NET Starter Kits' started by sellerb, Oct 7, 2007.

  1. I had no problems up until I tried to add the new add to the site. I read the error and I checked the table and foreign key. I don't see anything wrong. Please help!


    The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Ads_Members". The conflict occurred in database "SQL2005_416456_seller", table "dbo.classifieds_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 "SQL2005_416456_seller", table "dbo.classifieds_Members", column 'Id'.
    The statement has been terminated.

    Source Error:





    Code:
    Line 2055:            Dim returnValue As Object
    Line 2056:            Try 
    Line 2057:                returnValue = command.ExecuteScalar
    Line 2058:            Finally
    Line 2059:                If (previousConnectionState = System.Data.ConnectionState.Closed) Then
    Source File: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files\root\403fc228\e37f7ac7\App_Code.q_xemxho.5.vb Line: 2057

    Stack Trace:





    Code:
    [SqlException (0x80131904): The INSERT statement conflicted with the FOREIGN KEY constraint "FK_Ads_Members". The conflict occurred in database "SQL2005_416456_seller", table "dbo.classifieds_Members", column 'Id'.
    The statement has been terminated.]
       System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +862234
       System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +739110
       System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +188
       System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1956
       System.Data.SqlClient.SqlDataReader.ConsumeMetaData() +31
       System.Data.SqlClient.SqlDataReader.get_MetaData() +62
       System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString) +297
       System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async) +903
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, DbAsyncResult result) +132
       System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method) +32
       System.Data.SqlClient.SqlCommand.ExecuteScalar() +137
       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\root\403fc228\e37f7ac7\App_Code.q_xemxho.5.vb:2057
       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 E:\web\sellerbeawa\htdocs\App_Code\BLL\Ads.vb:100
       PostAd_aspx.PostAdWizard_FinishButtonClick(Object sender, WizardNavigationEventArgs e) in E:\web\sellerbeawa\htdocs\PostAd.aspx.vb:58
       System.Web.UI.WebControls.Wizard.OnFinishButtonClick(WizardNavigationEventArgs e) +105
       System.Web.UI.WebControls.Wizard.OnBubbleEvent(Object source, EventArgs e) +693
       System.Web.UI.WebControls.WizardChildTable.OnBubbleEvent(Object source, EventArgs args) +17
       System.Web.UI.Control.RaiseBubbleEvent(Object source, EventArgs args) +35
       System.Web.UI.WebControls.Button.OnCommand(CommandEventArgs e) +115
       System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) +163
       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.832; ASP.NET Version:2.0.50727.832 <!--
    [SqlException]: The INSERT statement conflicted with the FOREIGN KEY constraint 'FK_Ads_Members'. The conflict occurred in database 'SQL2005_416456_seller', table 'dbo.classifieds_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\root\403fc228\e37f7ac7\App_Code.q_xemxho.5.vb:line 2057
    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 E:\web\sellerbeawa\htdocs\App_Code\BLL\Ads.vb:line 100
    at PostAd_aspx.PostAdWizard_FinishButtonClick(Object sender, WizardNavigationEventArgs e) in E:\web\sellerbeawa\htdocs\PostAd.aspx.vb:line 58
    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)
    at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
    at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
    --><!--
    This error page might contain sensitive information because ASP.NET is configured to show verbose error messages using <customErrors mode="Off"/>. Consider using <customErrors mode="On"/> or <customErrors mode="RemoteOnly"/> in production environments.-->
     
  2. I fixed it. At least I think I did. It seems to be working. The only function not working is email. I set smtp in web.config and also set email in request.vb file. Still not sending email and not getting email to admin acount.
    Tired and will try again tomorrow. I hope someone can tell me what I did or didn't do by then.

    Thanks!
     
  3. Hey ,,,


    can u tell me how u fixed this problem


    thnx
     

Share This Page