Failed to open file ‘…’ , error 2 and error 22
How to restore a MySQL database in Windows To restore a MySQL database on a Windows machine: Place the database backup file in the root directory of your C: drive (trust me, this will make your life easier) Open the Command Prompt Start the MySQL command…
Disable database triggers in Microsoft SQL databases
If you need to temporarily disable triggers in Microsoft SQL databases during database maintenance use the following script --Disable triggers on all tables DECLARE @enable BIT = 0; DECLARE @trigger SYSNAME; DECLARE @table SYSNAME; DECLARE @cmd…
Disable foreign key constraints in Microsoft SQL databases
Databases do not allow the deletion of rows if those are referenced in other tables with the foreign key constraint. You can turn off the validation of foreign keys in Microsoft SQL databases for the duration of the maintenance with the following script.…
No Entity Framework provider found for the ADO.NET provider with invariant name ‘System.Data.SqlClient’
When one of the projects in your solution is referencing the Entity Framework to access a database the Entity Framework NuGet package is added to that project. In the Visual Studio IDE your application may work fine, but when you deploy it to the test or…
How to add a new table to an existing Microsoft SQL Server replication publication
To add a new table to an existing MS SQL Server publication Remote desktop into the database server, or a server in the same domain of the database server Start Microsoft SQL Server Management Studio (SSMS) Connect to the database with…
There is already an open DataReader associated with this Command which must be closed first
When your MVC 5 web application page tries to read the database using the Entity Framework in a loop you may get the following error message: InnerException: System.InvalidOperationException HResult=-2146233079 Message=There is already an open DataReader…
DbArithmeticExpression arguments must have a numeric common type
The Microsoft Visual Studio 2013 Entity Framework database query does not support the subtraction of two dates to calculate TimeSpan. For example the following statement will throw a runtime error: site.VisitFrequencySec < ((TimeSpan)(dtNow -…
The underlying provider failed on Open
When you get the following error message in Microsoft Visual Studio 2013 check the inner exception. System.Data.Entity.Core.EntityException was unhandled HResult=-2146233087 Message=The underlying provider failed on Open. Source=EntityFramework The…
The Entity Framework provider … could not be loaded
When you create a new Microsoft Visual Studio 2013 project that uses the Entity Framework you may get the following error message: The Entity Framework provider type ‘System.Data.Entity.SqlServer.SqlProviderServices,…
How to migrate the Visual Studio 2013 user database to SQL Server 2008
When you create a new web application in Microsoft Visual Studio 2013 the user database it creates is version 706. SQL Server 2008 can only open databases up to version 663 or earlier. To migrate the new Visual Studio 2013 databases to SQL Server 2008…