invalid object name sql server code example

Example 1: sqlexception: invalid object name

Since the error is SqlException: Invalid object name 'Movie', that means the table named 'Movie' has not created or the Database you are referring has not created.

To see if the Database or table 'Movie' has created, open SQL Server Object Explorer and check the Database name is the same as in appsettings.json. If the Database or table has not created, you may need a migration.

To migrate, open Tools-> NuGet Package Manager-> Package Manager Console and hit the following commands:

Add-Migration MigrationName
Update-Database
Then check SQL Server Object Explorer again or build and run your project.

Example 2: invalid object name sql

check your tables, columns, databases name properly

Tags:

Misc Example