Monday, January 23, 2012

How to connect SQL Server using Server Explorer

Here we will see to connect SQL server using Server Explorer

First of all when you have created any project suppose named as "DEMO" 

Now as per given below click
-> click on View  ->  Server Explorer

 you can create the  database right from within Visual Studio 2005. First, if Server Explorer is not visible select View, Server Explorer from the menu as . Now right Click on Data Connections, and pick “Add Connection…”.

Note do NOT pick the Create New SQL Server Database… option, this works with full blown SQL Server such as SQL Server Express.
Here on the next screen you can see that you have to choose Data Source ..
choose the "Microsoft SQL Server" click continue 
now after choosing the  Data Source 
on the next screen as you can see below here Data Source which you have entered by using   change button you can select othe Data Source .

Now In the Server  Name Dropdown box select your server name and as you can see the next panel that is "Log on to Server" there are given two modes windows authentication and SQl Server Authentication .

if you want use or create Database in your machine locally you have to select windows authentication and in the case you want connect remote server select the SQL Server Authentication here you have to specify the remote server User Name or Password .

next you have to specify the Your Database Name here our database name "Demo"

Returning to the Server Explorer, your new database (which I named Demo) should be listed in your Data Connections tree. Click the + button to expand, and you can see the Tables, System Views (not to be confused with a traditional database view), and a Replication folder.

Note that if you wanted to open an existing  database, you’d simply skip the steps associated with the Create button. Instead you’d simply pick “Add Connection…”, key in (or browse for) the database name, enter the password and click Open.

No comments:

Post a Comment