How to Resolve: [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect)

This article, provides useful troubleshooting tips, for the following error which you might get, under certain circumstances, when trying to connect to SQL Server from Python, using pyodbc: [IM002] [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified (0) (SQLDriverConnect). Prior to sharing our tips for troubleshooting the issue, let’s discuss … Read more…

Useful Python Programming Tips

In this post, I will be regularly posting useful Python programming tips. These tips will be organized in different categories, in order to make it easier to read it.   Hello World in Python The below command, prints a “Hello World” message from within a Python script: print(“Hello World from Python”)   Code Indentation in … Read more…

Working with Python on Windows and SQL Server Databases (Course Preview)

In this post, we are announcing the general availability of our online course: “Working with Python on Windows and SQL Server Databases“. Note that the course is currently available on Udemy.   What is this course all About? Python is a very popular programming language. Due to its simplified syntax, Programmers can develop a wide … Read more…

How to Connect to SQL Server from Visual C++

In this article, we are going to see, step by step, how we can connect to SQL Server from a Visual C++ program using an ODBC connection. Prior to start reading, if you are really interested in learning Programming, then you should definitely check my 6-hour online course, “Introduction to Computer Programming for Beginners“. My … Read more…

There is no argument given that corresponds to the required formal parameter

When working with Inheritance in C#, under certain circumstances, you might get an error message similar to this: There is no argument given that corresponds to the required formal parameter. Don’t worry, the above error can be easily resolved. Let’s see a full example, by first reproducing the error.   Reproducing the Error Message Consider … Read more…

Using the C# SqlParameter Object for Writing More Secure Code

C# SqlParameter is a handy feature allows you to safely pass a parameter to a SqlCommand object in .NET. A security best practice when writing .NET data access code, is to always use parameters in SqlCommand objects (whenever parameters are required of course). The reason for this, is that parameters help prevent SQL injection attacks. … Read more…

How to Establish a Simple Connection from a C# Program to SQL Server

This article, provides a basic example, on how to establish a connection to SQL Server from a C# program with the use of the “using” statement in C# which help you better managing your database connections.   Using the System.Data.SqlClient Use the System.Data.SqlClient namespace in the top section of your code as below: using System.Data.SqlClient;   … Read more…

Cannot implicitly convert type ‘string’ to ‘System.Windows.Forms.DataGridViewTextBoxColumn

When developing a .NET application (i.e. in C#), under certain circumstances, you might get the error message: Cannot implicitly convert type ‘string’ to ‘System.Windows.Forms.DataGridViewTextBoxColumn   Example of Exception in Visual Studio when Using the Reserved Word “Name” as a DataGridView Column Name.   Why you got the implicit conversion error If you get the above error, … Read more…

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: 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 was reached.   Why you get the connection … Read more…

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 code should be similar as … Read more…