Click here to Skip to main content
13,191,400 members (77,574 online)
Click here to Skip to main content
Add your own
alternative version


16 bookmarked
Posted 2 Aug 2006

Connecting to Database Express 2005 with VS 2005

, 2 Aug 2006
Rate this:
Please Sign up or sign in to vote.
Codes to help to connect VS 2005 to SQL Express manualy
<!-- Article Starts - DO NOT ADD HTML/BODY START TAGS-->


After install Visual Studio 2005, you must install “SQL Server Management Studio Express CTP”. This program plugs into SQL Express 2005. Run SQL Server Management Studio Express CTP and press connect to connect into Server Management Studio Express. <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /><v:shapetype id=_x0000_t75 stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"><v:stroke joinstyle="miter"><v:formulas><v:f eqn="if lineDrawn pixelLineWidth 0"><v:f eqn="sum @0 1 0"><v:f eqn="sum 0 0 @1"><v:f eqn="prod @2 1 2"><v:f eqn="prod @3 21600 pixelWidth"><v:f eqn="prod @3 21600 pixelHeight"><v:f eqn="sum @0 0 1"><v:f eqn="prod @6 1 2"><v:f eqn="prod @7 21600 pixelWidth"><v:f eqn="sum @8 21600 0"><v:f eqn="prod @7 21600 pixelHeight"><v:f eqn="sum @10 21600 0"><v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"><o:lock aspectratio="t" v:ext="edit"><o:p>



<v:shape id=_x0000_s1026 style="MARGIN-TOP: 1.15pt; Z-INDEX: -2; LEFT: 0px; MARGIN-LEFT: 9pt; WIDTH: 230.25pt; POSITION: absolute; HEIGHT: 179.25pt; TEXT-ALIGN: left" type="#_x0000_t75" wrapcoords="-70 0 -70 21510 21600 21510 21600 0 -70 0"><v:imagedata o:title="newdatabase" src="file:///C:\DOCUME~1\FEROCH~1\LOCALS~1\Temp\msohtml1\05\clip_image003.png"><?xml:namespace prefix = w ns = "urn:schemas-microsoft-com:office:word" /><w:wrap type="tight">After connect, you must make a new database and a new table, for example:

make database and give a name for a new database “Practice_1”.

Then, make one table which consist of field “No” and field “Name” and give name for a new table “Checklist”.

After finish making your table, please input same data into your table. Now run your Visual Studio 2005 and make new application windows.  Drag dataGridView into your design form and choose dock in properties become fill. Double click your form and insert these codes: <o:p>

<o:p> <o:p> 

<v:rect id=_x0000_s1027 style="MARGIN-TOP: 9pt; Z-INDEX: 2; LEFT: 0px; MARGIN-LEFT: 9pt; WIDTH: 423pt; POSITION: absolute; HEIGHT: 3in; TEXT-ALIGN: left"><o:p>

string connstring = "Data Source = .\\SQLEXPRESS; <o:p>

Initial Catalog = Practice_1; Integrated Security = True";<o:p>


SqlConnection conn = new SqlConnection(connstring);<o:p>

SqlCommand comm = new SqlCommand();<o:p>

comm.Connection = conn;<o:p>

SqlDataAdapter myadapter = new SqlDataAdapter(comm);<o:p>

DataSet myset = new DataSet();<o:p>




comm.CommandText = "Select * From Checklist ";<o:p>


myadapter.Fill(myset, "Checklist");<o:p>

dataGridView1.DataSource = myset;<o:p>

dataGridView1.DataMember = "Checklist";<o:p>




The codes above must use “Using System.Data.SQLClient”.<o:p>

Start Debugging your program and at your dataGridView will come up data which you have filled when making of Database.<o:p>


This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


About the Author

Software Developer (Senior)
Indonesia Indonesia
No Biography provided

You may also be interested in...

Comments and Discussions

GeneralInteresting Pin
Batman231395-Dec-07 9:18
sussBatman231395-Dec-07 9:18 
GeneralThanks Pin
Glen Harvy20-Mar-07 19:32
memberGlen Harvy20-Mar-07 19:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web02 | 2.8.171017.1 | Last Updated 2 Aug 2006
Article Copyright 2006 by efero
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid