Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7064409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T04:49:51+00:00 2026-05-28T04:49:51+00:00

I am new to ASP.net’s MVC 3 (using VB) and I am trying to

  • 0

I am new to ASP.net’s MVC 3 (using VB) and I am trying to create an application that would connect to an SQL 2008 server database. I have gone through a tutorial (Microsoft ASP.net’s Movie DB tutorial) but the tutorial uses SQL compact edition. I am having a hard time connecting. Am I correct in assuming that once I create a model, I should be able to just connect to SQL 2008 by changing the connection string in the Web.config file, found at the root of the application folder? I deleted the sql ce database from the App_Data folder. In Microsoft SQL Server Management Studio I created a new database. I then added this to my Web.config file:

      <connectionStrings>
<add name="ConnectionName"
     providerName="System.Data.SqlClient"
     connectionString="Data Source=DELERIUM-PC;Initial Catalog=iDjItDb;Integrated         Security=True" />
       </connectionStrings>

The when I run the app, and try to view the controller associated with the model, i get this error:

The model backing the ‘iDjItDBContext’ context has changed since
the database was created. Either manually delete/update the database,
or call Database.SetInitializer with an IDatabaseInitializer instance.
For example, the DropCreateDatabaseIfModelChanges strategy will
automatically delete and recreate the database, and optionally seed it
with new data.

What must I do to connect and work with a 2008 SQL database?

Thanks
jason

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T04:49:52+00:00Added an answer on May 28, 2026 at 4:49 am

    You can remove the IncludeMetadataConvention in your context class if you are positive that your model is compatible with the database.

    public class iDjItDBContext : DBContext
    {
        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            modelBuilder.Conventions.Remove<IncludeMetadataConvention>();
        }
    }
    

    Otherwise you need to set the initializer in the Application_Start() method of your Global.asax.cs file.

    Database.SetInitializer<iDjItDBContext>(
            new DropCreateDatabaseIfModelChanges<iDjItDBContext>());
    

    Otherwise you can take the Migrations option where an external tool will generate the change script.

    Edit
    Change the connection string name to iDjItDBContext so that the name matches with the DbContext name.

    <connectionStrings>
    <add name="iDjItDBContext"
         providerName="System.Data.SqlClient"
         connectionString="Data Source=DELERIUM-PC;Initial Catalog=iDjItDb;Integrated         Security=True" />
           </connectionStrings>
    

    Or create a constructor in your context and pass the name of the connection string.

    public class iDjItDBContext : DBContext
    {
         public iDjItDBContext() : base("ConnectionName")
         {
         }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I create new ASP.NET web application that use SMTP to send message. The problem
For my new asp.net application that I am developing I would like to generate
If you create a new ASP.NET MVC 2 Web Application and run it, you
I created a new ASP .net mvc 2 web application with that default template
I have a new ASP.Net MVC application that I am about to start and
On a new ASP.NET MVC application we are following a TDD approach, using NUnit
I am implementing a new ASP.NET MVC 3 application that will use a form
Create a new ASP.NET MVC Web Application Create an ASP.NET App_Code Folder Inside the
I'm trying to learn the new ASP .NET MVC framework and would like to
My new ASP.NET MVC Web Application works on my development workstation, but does not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.