In my previous post I show how to install SQL Server 2008. You need to install SQL Server 2008 SP1. I don’t install it yet. In this post I am going to show
1. Some basics of SQL server management studio with connection.
2. Connect Visual Studio 2010 with SQL Server 2008
Now I am going to start:
Step 1: Go to Start Menu then find Microsoft SQL Server 2008 then SQL Server Management Studio.
Step 2: A window will open from which you have to login to Database Engine to perform any operation. Here for the authentication we have two option Windows Authentication, SQL Server Authentication. I select mixed mode in my installation process. So that I am able to login in both way. For SQL Server Authentication we need Username and Password. For username we have to use “sa” and password which we provide in the time of installation.
Step 3: After clicking connect it will connect to database engine. And then a window will open where in the object explorer it will show some databases which has been created by default.
Step 4: To create a Database Right Click on the Databases and Click New Database
Step 5: Now provide the database name as your wish. Here I am giving DatabaseTest. And click OK
Step 6: Now Expand the DatabaseTest. From there Right Click on the Tables and then click on new tables.
Step 7: Now under the column add column name and its data type. If you do not want to allow null value the uncheck the Allow Nulls.
Step 8: To set a Primary key Right Click on the right of the column name and select Set as a primary key.
Step 9: To Save this file Press CTRL+s and provide a table name to save.
Insert Or Updating data of table:
To insert or update data right click on the table name and select Edit Top 200 Rows as follows:
Now insert data as follow:
In this way you can insert update data. to delete data right click on the left side of row and select delete to delete data.
Now I am going to show you the way to connect Visual Studio 2010 with MS SQL.
Step 1: Open Visual Studio and Open a project. Here I am not going to show how to open a project of ASP.NET or Web Application I will post it later. To know how to connect you need not to open a project. Now come to the point. First of all from the View menu select Server Explorer to show the server explorer if you do not already show it.
Step 2: A new windows will appear. From there select Microsoft SQL Server. OK
Step 3: Now Type your PC-Name\SQLEXPRESS as the following figure.
Step 4: If you want to use Windows Authentication then check Use Windows Authentication or if you want to use SQL server Authentication then check it and provide username (sa) and password (which you provide during installation). Now click on the Test Connection button to test every thing is ok or not? If there is no error then select a database from the dropdown list and press OK.
Step 5: Now in VS you will be able to see as following in Server Explorer. Thant means your visual studio is connected to sql server.Now your Visual Studio is connected with SQL Server. Enjoy.
Thanks.
nice post
Thanks kishor vhi.
but i am not getting how to create table
Thanks for Help,It so Great ,…….
Thanks for Help,It so Great ,…….Thanks for Help,It so Great ,…….Thanks for Help,It so Great ,and Thank you.
may you can help me to connect VS2010 to MySQL server installed in Ubuntu server.
Thank you again.
BR,
Thanks
mantappp
this is what i looking for in 1 month
thanx a lot…
this tutorial really help me very much..
Thank you very much. This was a very useful tutorial for beginners like me :).
Thank you for this tutorial.
Been looking for something like this for quite a while.
hey do u know how to display the content of the table present in sql in ms visual studio..i need the coding part..:)
try this
or try google by searching bind data in ms-sql visual studio.
Thanks
can other pc that run vb2010 connect to this database?? tq..
off course, but in that case you have to enable TCP/IP service from the SQL Server Management Console.
Thanks.
arzib vai apni ki bengali? amar aro help lagbo, email id diben?
hmm, ami bangali from Bangladesh. you can mail me at razibdeb at gmail dot com
Hi! I’m stuck in this part (https://razibdeb.files.wordpress.com/2011/01/ms-sql.png) of your tutorial. My PC does not have ‘Microsoft SQL Server’ as one of the options. How do I fix this?
May be you didn’t install Microsoft SQL server properly. Reinstall the MS SQL Server.
very nice
nice thanks
thanks buddy…:)
why my vb.net cannot identify server explorer?? i try to find in database explorer however, my MS.sqlClient not display??
i hope you can give me the solution and the option to connect the server with vb.net
thankss:
try logging with YOURPCNANE-PC\SQLEXPRESS & windows authentication
thanks..
i already find the solution.. it not about sql server 2008 r2 that i install, but its about the visual studio that i install..
a bit difference between visual studio express and visual studio prof…
so those who have same problem like me
please go to this link : http://download.cnet.com/Microsoft-Visual-Studio-2010-Professional/3000-2212_4-10618634.html?tag=mncol;1
i hope this can solve your problem to find “server explore”
Thanks for sharing with us.
heloooooooooo
ur post is excellent…
plzzzzzzzzz tell me that how i can execute queries (add,delete,update after connection)
thank u very much for ur post… now only i know how to connect the visual studio and Sql server 2008
hi. thanx for the adds.. It works, How can I use the connection string to insert data into database.. Please Help…
how to insert delete and update a record in sql server 2008 through web form using c# language
thanks for the post. it work to me
ThanQ for this Solution……
Thank u so much,,God wil reward u for good. for dis ur posting
Thanks Man
excuse me sir. can you help me with my project. the add, update, delete doesnt function well in my program. do you have any sample programs that can add, edit, delete data from ms sql server 2008 r2? please help me.
Thanks Razib 🙂
Can you coding explain the any project .net
Hi
I like your simplicity& clearance of your explanation.
I am looking for tempelte desging for VS2010 or VS2010 , so u can import it & modify it
Hi. Thanks for sharing this article. But i am unable to deploy sql server database in windows form application installer setup. Can you help in this issue.
Plz anybody tell me after above task what I have to do to access data. I mean any other settings or extra code needed or just write down the data access query?
Thank you.
It help a lot.
Thanks alot really. Useful product
right bro and thanks…..
how to connect visual studio to sql server? i created website using visual studio in local host, i wont to connect website to sql database. how to do it?