Table 'advancebillmonths' already exists RRS feed

  • General discussion

  • Server Error in '/' Application.

    Table 'advancebillmonths' already exists

    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: MySql.Data.MySqlClient.MySqlException: Table 'advancebillmonths' already exists

    Source Error: 
    Line 20:             DContext db = new DContext();
    Line 21: 
    Line 22:             if (db.schoolroles.ToList().Count < 1)
    Line 23:             { 
    Line 24:                 SchoolRole role = new SchoolRole();
    • Edited by Umesh K Mandal Thursday, July 26, 2018 10:49 AM
    • Moved by CoolDadTx Thursday, July 26, 2018 1:54 PM EF related
    Thursday, July 26, 2018 10:12 AM

All replies

  • Sounds like you're using EF and you have it set to create the DB at startup. If you're DB already exists then you should disable this option.

    public class DContext : DbContext
       static DContext ()
    Alternatively, in newer versions of EF you can also do this via a config entry.

    Please post further EF questions in the Entity Framework forums.

    Michael Taylor

    Thursday, July 26, 2018 1:54 PM