none
Why isn’t a table’s column name being recognized? RRS feed

  • Question

  • I created a table with Server Explorer named ForumTexts, which is named ForumText1 in DataClasses.dbml for my website.  The table appears to be recognized as ForumText, but I get an error when I try to access column data from that table with the following C# code:

     

    ForumText forumtext = db.ForumTexts.SingleOrDefault(p => p.ForumTextID == TextID);

    if (forumtext != null)

    { // Forum text record accessed

        if (forumtext.NextForumTextID != null)

     

    When I attempt to start the website locally without debugging, this code generates an error that states: ‘ForumText’ does not contain a definition for ‘NextForumTextID’ and no extension method.  Server Explorer clearly shows table ForumTexts as being defined with this column. So, I don’t know what the problem is.  Please help.

     

    Maurice

    Sunday, February 16, 2014 12:16 AM

Answers

  • I resolved this problem simply by changing the name of the table from ForumTexts to ForumCharacters.  I don’t know why the server could not work with the prior table name, but it does not matter now that everything works fine with the new name.

     

    Maurice

    • Marked as answer by Maurice Osborn Sunday, February 16, 2014 9:37 PM
    Sunday, February 16, 2014 9:37 PM