I am new to .Net and I have made a fresh installation of Visual Studio 2012 Express for Web through the Microsoft Web Platform Installer 4.0.
After installation, here is my configuration :
Visual Studio 2012 Express for Web
SQL Server 2012 Express
IIS Express
I quickly created a project with ASP.Net and MVC 4.
I then created (inside the Database explorer view) a file-based database (.MDF file). It contains 4 tables and data.
What do i need to do to use that database inside my project ?
This link http://msdn.microsoft.com/en-us/library/dd469575%28v=vs.100%29.aspx says that I need to right-click the App_Data folder, and then click
Add Existing Item.
Is that all ?
Where is the connection to the database defined after that ? Is it done automatically or do i need to do it manually ? If yes, which file ?
if you want create connectinstring simply drag sqldatasource and configure using wizard. Save the connection, you will get it in web.config automaticaly.
longbeach751
0 Points
3 Posts
Adding an existing MDF file to a ASP.Net MVC 4 project in Visual Studio 2012 ?
Dec 21, 2012 09:05 PM|LINK
Hi,
I am new to .Net and I have made a fresh installation of Visual Studio 2012 Express for Web through the Microsoft Web Platform Installer 4.0.
After installation, here is my configuration :
Visual Studio 2012 Express for Web
SQL Server 2012 Express
IIS Express
I quickly created a project with ASP.Net and MVC 4.
I then created (inside the Database explorer view) a file-based database (.MDF file). It contains 4 tables and data.
What do i need to do to use that database inside my project ?
This link http://msdn.microsoft.com/en-us/library/dd469575%28v=vs.100%29.aspx says that I need to right-click the App_Data folder, and then click Add Existing Item.
Is that all ?
Where is the connection to the database defined after that ? Is it done automatically or do i need to do it manually ? If yes, which file ?
Thanks for helping.
Bimalvv
Contributor
2356 Points
478 Posts
Re: Adding an existing MDF file to a ASP.Net MVC 4 project in Visual Studio 2012 ?
Dec 21, 2012 09:28 PM|LINK
Hi,
Try to go through the Example given in this link
http://msdn.microsoft.com/en-us/library/dd410121%28v=vs.100%29.aspx
Bimal
oned_gk
All-Star
31828 Points
6514 Posts
Re: Adding an existing MDF file to a ASP.Net MVC 4 project in Visual Studio 2012 ?
Dec 21, 2012 10:12 PM|LINK
longbeach751
0 Points
3 Posts
Re: Adding an existing MDF file to a ASP.Net MVC 4 project in Visual Studio 2012 ?
Dec 21, 2012 10:38 PM|LINK
Drag sqldatasource from where ?
Here is what my current project looks like :
http://imageshack.us/photo/my-images/39/capturemdf.png/
oned_gk
All-Star
31828 Points
6514 Posts
Re: Adding an existing MDF file to a ASP.Net MVC 4 project in Visual Studio 2012 ?
Dec 21, 2012 10:45 PM|LINK
longbeach751
0 Points
3 Posts
Re: Adding an existing MDF file to a ASP.Net MVC 4 project in Visual Studio 2012 ?
Dec 22, 2012 06:23 AM|LINK
drag from where ??
Catherine Sh...
All-Star
23382 Points
2490 Posts
Microsoft
Re: Adding an existing MDF file to a ASP.Net MVC 4 project in Visual Studio 2012 ?
Dec 26, 2012 01:59 AM|LINK
Hi,
For your issue, you can try to drag from the Server Explorer in Visual Studio as follows:
In addition, you can refer to: How to use the Server Explorer in Visual Studio .NET and Visual Studio 2005
Best wishes,
Feedback to us
Develop and promote your apps in Windows Store