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 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:
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.
To know more, download this file
For More:-
- Xml Application
- Make Captcha image for Asp.Net Application
- Create .dll File and Use in Asp.net Application
- Interview Questions and Answers
- Exception Handling
- Transaction in Sql server
- Directory and directory info class
- Delegate in c#
- Namespace in .net
- Out parameter in c#
- Call by value and call by reference in c#
- Interface in c#
Download whole attached application.
Download
Is this necessary to create a empty website to create a database from solution explorer?
ReplyDeleteI have a database i want to add that in App_Data,what i have to do?
it is not necessary You can create your database in sql server separately and connect to your asp.net website.In this there are no need to add it on the website you can host as it in on your server.yes, you can add it.go solution Explorer--.create App-Data folder -->right click on this folder-->Add Existing items-->select your database file but it should be in .mdf or .sdf format.
DeleteWhen I click --ADD Existing Items-->Selected the database-->this error comes up("Unadle to add(databasesource...Database.mdf) Access is denied)
Deletehello sir
ReplyDeleteit was a great experience to work with step by step instructions but i have a problem to add database file due to use of sqlserver2010 please give me help to solve my problem .
please specify the error.........
Deletehello sir
ReplyDeletei followed your steps for inserting the .mdf file in website but it is showing an error that "The file cannot be opened because it is being in used by another file try it again." Please help me out
Hi deepa ! you have not configured connection string correctly.First change your connection strings from below link
Deletehttp://www.msdotnet.co.in/2013/12/how-to-use-different-connection-strings.html
you can use any connection string instead of your connection strings then It will work definitely.if any problem ask again and share this website to friends.
Thnk uuuuu so much u solved my last pblm....... But I hv one more question... I want to create a table in database.. When I click on table--> right click --> design. Its shows me ( column name, data type, and Allow nulls) when I set this now I want to put a data in this table.... where I put the data.
ReplyDeleteWaiting.....
ReplyDeletehi rumaisa ! first open your solution explorer -->Open Database.mdf file -->
DeleteRight click Tables --> Add New Table -->Now fill your Column Name,Data Type,Allow Nulls fields
--> Now click Save Button-->Enter your table Name (ex.student) -->OK.
Now you have created your table(student)with some columns.
Now Right click your table (ex.student)-->Show Table Data--> Now Write your table (student) values --> save it
--> Now you have done.
you can see you table data-->Right click on Table (student)-->click show Table Data
I followed Ur all d steps.... but when I saved a table... then right click on table,, I am not finding any option there ,,Show Table Data..
DeleteHi Rumaisa ! Right click on Your saved table Name (ex. student)-->Show Table Data
Deleteit will work definitely....
i clicked on saved table but still not get Show Table data option.. Cant understand where i enter data..If possible please send SnapShot.
ReplyDeleteHi Rumaisa khan ! here i can't post snapshot.you can directly contact me through contact form or email msdotnet@hotmail.com .i will help you definitely..
Deletehiii sir i have done step1,2 but while adding database.mdf file to application its showing same error plzzz help me sir...
ReplyDeletehi KALAYANI !
Deletehave you already installed sql database 2008 or other in your system.first install sql database then follow the above steps,then it will work definitely. if you face same problem same again then specify the error message then i will see it..
I am also experiencing the same problem and i have already installed the sql database 2008 in my system
Deletehiii sir i have done all steps but while adding database.mdf file to application its showing same error plzzz help me...
ReplyDeleteplease help me the same error is occuring as shown in first image in your site. please give me a perfect solution for visual studio sql error
ReplyDeletehii i am using sql server 2008 r2 , i did follow the steps for solve the problem , but i am not able to see any file , help me
ReplyDeleteI have follow all ur steps..still the same error come with database
ReplyDelete