When you try to connect to a SQL Server database from a client application, under certain circumstances, you might get the below error message: A connection was successfully established with the server, but then an error occurred during the login process. (provider: Named Pipes Provider, error: 0 – No process is on…

How to Establish a Simple Connection from a C# Program to SQL Server
This is a basic example on how to establish a connection to SQL Server from a C# program. Use the System.Data.SqlClient namespace in the top section of your code as below:using System.Data.SqlClient; Set the connection string – Trusted connection (Windows Authentication). In the below example I’m using “master” as the default…

Cannot implicitly convert type ‘string’ to ‘System.Windows.Forms.DataGridViewTextBoxColumn
If you get the above error message when developing a .NET application, then you have most probably set as a column name for one of your datagridview column the reserved word ‘name‘. Example of Exception in Visual Studio when Using the Reserved Word “Name” as a DataGridView Column Name. If…
The timeout period elapsed prior to obtaining a connection from the pool
If you are working with .NET applications, at some time you might get the below (or similar) error message: Exception message: Timeout expired. The timeout period elapsed prior to obtaining a connection from the pool. This may have occurred because all pooled connections were in use and max pool size…
Closing a C# Application (including hidden forms)
There are many times when we develop C# applications, where we make use of several forms. To this end, there are times that we are using the Hide() method for some of these forms thus hiding the forms, but not closing or disposing them. Nevertheless, in the main form of…
Changing the startup form in a C# project
Open the C# project properties. In the “Application” tab set the Startup object to “WindowsFormsApplication1.Program”. The “WindowsFormsApplication1” reflects the name of your current C# project so it could be different than the project name presented here. Then in the solution explorer, under the project tree, open the “Program.cs” file. The…