How to Connect SQL Server In C#

This time, I will teach you how to connect SQL Server 2005 to C# using Microsoft Visual Studio 2008. With this, you can create a connection between and SQL Server 2005 database.

connectionSQLoutPutPI connect SQL Server

Let’s begin:

SQL Select Statements Using Logical... x
SQL Select Statements Using Logical Conditions with Example | 2020 Best Practices

First, open Visual Studio and create a new project.


The window of “New Project” will appear. In the New Project window, select “Visual C#” and create a new Windows Form Application.


Do the form just like this.


Now, double click a button and do the following codes for the connection between SQL Server and Visual C#.

Note: Put using System.Data.SqlClient; above the namespace to access sql server library.



You can do this following example:

Reminder: You must put your database file(testdb.mdf) inside the bin folder of your project to make this second example work.




For all students who need programmer for your thesis system or anyone who needs a sourcecode in any programming languages. You can contact me @ :
Email – [email protected]
Mobile No. – 09305235027 – tnt

Project Name : How to Connect SQL Server to C#
Project Platform :C#
Programming Language Used:C# Programming Language
Developer Name
IDE Tool (Recommended):Visual Studio 2019
Project Type :Desktop Application
Database:MySQL Database
Upload Date and Time:June 11, 2016- 10:09 am

Leave a Comment