How to add a DataGridView to a Windows Form

To display data in a DataGridView on a Windows Form Add a new form to the Win Form Application project Drag a BindingSource from the Toolbox to the form   The bindingSource object appears below the form   Rename the Binding Source Select the bindingSource1 object below the form Press F4 to display the Properties …

How to test SOAP web services from outside of the server with a web browser

SOAP web services that accept primitive type arguments (string, int, etc.) can be tested from a web browser. For security reasons this feature is disabled if the web browser runs on another machine. To enable testing the SOAP web services in the test environment from another machine add the following to the system.web section of …

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 – site.LastVisitDate)).TotalSeconds) To solve the problem create a computed database column to calculate the difference between the dates and use the computed …

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 inner exception gives you detailed information on the real cause of the error. Most of the time the inner exception is the following: InnerException: …

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, EntityFramework.SqlServer’ registered in the application config file for the ADO.NET provider with invariant name ‘System.Data.SqlClient’ could not be loaded. Make sure that the assembly-qualified name is used …

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 script the database tables and create them again in the …

Display deleted items in the Microsoft Visual Studio Source Control Explorer

When you delete a file or folder in TFS by default it is no longer displayed in the Source Control Explorer. To be able to “undelete” a file or folder enable the visibility of deleted items in Microsoft Visual Studio. To see deleted items in the Source Control Explorer Start Visual Studio In the Tools …

How to open SQL files in Visual Studio 2012

The default installation of Visual Studio 2012 cannot open SQL documents when you double click on them in Source Control Explorer.  To be able to do that you have to install the SQL Server Data Tools  for Visual Studio 2012 Open the ” December 2012″ update page at http://msdn.microsoft.com/en-us/jj650015 Download and install SSDTSetup.exe by clicking Download …

Add if conditional statement to the Visual Studio pre-build and post-build events

There are times when you want to execute statements in the pre-build and post-build events of a Microsoft Visual Studio project when certain conditions met. In the next example we will copy the environment specific config file to the web application folder if the configuration is set to “Local”. To edit the pre-buld and post-buld …

How to add the Config folder to a Microsoft Visual Studio project even if the folder is not in the project directory

Corporations maintain multiple server environments for development, testing and production purposes. All of these environments require specific settings to connect to the databases and other resources. When the build master builds the application for the specific environment the build process has to select the appropriate configuration and build it into the installer file for deployment. …