15 February 2014

How to solve problem to add Sql Server2008R2(.mdf) in Visual studio 2010

Hi friends! There are some persons who are  faced problem, when they add database(.mdf) on Asp.Net website in visual studio 2010. I have also faced this type of problem .
When you add database(.mdf) on Asp.Net website in visual studio 2010 and following error occurs which is shown below,then you can solve this problem easily.
see it:

  There are some steps to solve this error and add (.mdf) database on Asp.Net website.

Step 1- First open your visual studio->New->Website->Asp.Net Empty Website->ok.

Step 2- Now go Tools-->Options-->Database Tools->click Data connection-->Now remove Sql Server Instance Name from Right hand box -->click ok.
see it:

Step 3- Now  open solution Explorer-->Right click on website-->Add
New Item-->Select Sql Server Database-->click Add.Then you can see  that database(.mdf) is added on your website.
see it;

Step 4-
If you want to add tables in this database(.mdf),then
double click on Database.mdf-->Server Explorer will opened-->Right click on Tables-->
Add New Table-->Now fill up column fields-->click save button on visual studio-->
Write your table name-->Click ok.
Now you will see, Your table will be created.Here i have created a student1 table.
see it:

Note:- You can solve this type of problem in any version of visual studio and Microsoft sql server.
When some times your Sql server 2008 R2(any) services is not working properly then follow following steps which is given below:

Go Start-->All programs-->Microsoft Sql Server 2008 R2-->Configuration Tools-->Sql Server Configuration Manager-->One popup will open-->click yes-->Now click Sql server Services-->Right click and start each services as shown below:


when you will start above two services then your sql server 2008 R2(any other), will work properly.

No comments:

Post a Comment