locked
Why are all references to one table not being recognized? RRS feed

  • Question

  • User-696641838 posted

    When creating a website with pages containing code in separate code segments, I keep getting Error 18 messages when I run the “Start without Debugging” option.  This is only happening wherever there are references to only one table out of many tables.  All accesses to other tables in the database work fine.  I made certain that the table exists in the .mdf file within Server explorer and the DataClasses.dbml has a reference to the dbo.EFmails table.  The error message states: “Error 18 Cannot implicitly convert type 'EFmail [c:\Users\Maurice Osborn\AppData\Local\Temp\Temporary ASP.NET Files\enc\c8745f7a\a0508868\App_Code.5dbvprak.dll]' to 'EFmail [c:\Users\Maurice Osborn\Documents\Visual Studio 2008\WebSites\ENC\EFmail.aspx.cs(14)]'”.  This occurs at all lines in every code file where the following code exists: “EFmail efmail = db.EFmails.SingleOrDefault(p => p.Callsign == Name);”.  Please help.

     

    Maurice

    Thursday, October 10, 2013 1:46 PM

Answers

  • User398825048 posted

    Try to delete the existing references from your temporary asp.net files and then again add the references and see if it works.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 11, 2013 2:46 AM

All replies

  • User398825048 posted

    Try to delete the existing references from your temporary asp.net files and then again add the references and see if it works.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, October 11, 2013 2:46 AM
  • User-696641838 posted

    Never mind.  I discovered that you cannot have a code segment (and main segment) with the same name as a table that you are using in separate code segments.  I did not have this problem when using the same code with combined code and content files, but I did when the segments were separated.  I changed the names for all pages that used the same table names and it works fine now.  What a hassle!

     

    Maurice

    Friday, October 11, 2013 11:23 AM