How to connect database SQL server 2008 with visual studio 2010

SQL server

SQL server

SQL server very critical function for every online server server provider. In computer software development , The database create and database design  is most important part .Any software must have database , It has to design and connect it with a interfacing IDE (Integrated Development Environment) . Desktop based software development and web based software development must have to connect database . Database connection is the major issue and a problem in computer software programming . In this session we have described about database connection with Visual Studio 2010 in C sharp language .If we can not connect database properly , it must be create problem in the time while we want to create an EXE file for installing the database software in our real application .


Here the database name is DUCT.mdf and it saved in drive D and the folder of the database name is db. A Gateway class is  used for handling the connection string . Here also a Gateway constructor  for initialize the class. It is format of object oriented programming and also used for tips and tricks for software development using computer.



using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;


namespace DuckDesign.Gateway


public class Gateway


string connectionString = @”server = .\D:\db\DUCT.mdf; integrated security = SSPI;”;

public string GetConnection()


return connectionString;




Click Here to Leave a Comment Below 5 comments
Bubbi - May 10, 2016

Briaillnce for free; your parents must be a sweetheart and a certified genius.

a knockout post - July 23, 2016

I just want to say I am just newbie to blogs and absolutely liked your web site. Very likely I’m likely to bookmark your website . You surely have incredible writings. With thanks for revealing your web-site.

Flor - November 16, 2016

Here are some variables which you can contemplate while purchasing Garcinia
Cambogia extract.

91Casey - December 10, 2016

Hello admin !! I read your blog everyday and i must say you have hi quality
posts here. Your blog deserves to go viral. You
need initial boost only. How to go viral fast? Search for; forbesden’s

Antonio96 - December 17, 2016

Hello, i see that your blog loads very slow, it took around 8 seconds to load this article.
Do you know that website speed is major ranking factor for google now?
If you speed up your page you will rank higher and get more
targeted traffic. Something may interest you, search for: pandatsor’s
tools faster website


Leave a Reply: