简体   繁体   English

ASP.NET MVC 4-如何在删除旧项目的同时将SQL Server Express DB移至新项目?

[英]ASP.NET MVC 4 - How to move SQL Server Express DB to new project while deleting old project?

I started an ASP.NET MVC 4 app in an old project, then stopped development on it for a while. 我在一个旧项目中启动了一个ASP.NET MVC 4应用程序,然后暂停了一段时间。 Now I'm back to working on this project, but (for a number of reasons) I've decided to start fresh from a new project solution. 现在,我回到这个项目上,但是(由于多种原因)我决定从一个新的项目解决方案中重新开始。 The one thing I'd like to keep from the old project is the DB (SQL Server Express). 我想保留旧项目的一件事是DB(SQL Server Express)。 How can I move/copy the DB into the new solution (keeping in mind that I'll probably delete the old solution entirely after I see everything is working properly in the new solution)? 如何将数据库移动/复制到新解决方案中(请注意,当我看到新解决方案中的所有功能均正常运行后,可能会完全删除旧解决方案)? The old project used aspx and the new one uses Razor. 旧项目使用aspx,新项目使用Razor。 Both projects are in C#. 这两个项目都在C#中。

Can I simply copy and paste the APP_DATA folder from the old project into the new one? 我可以简单地将APP_DATA文件夹从旧项目复制并粘贴到新项目中吗? If so, should I do this from Visual Studio somehow, or can I just go into Windows Explorer directly? 如果是这样,我应该以某种方式从Visual Studio中执行此操作,还是可以直接进入Windows资源管理器? If I did this, what settings/configurations/connection strings would I need to modify? 如果这样做,我需要修改哪些设置/配置/连接字符串? Please keep in mind that this is the first time I've done a project linked to a database, so I need lots of details. 请记住,这是我第一次完成链接到数据库的项目,因此我需要很多细节。

Also, I'm figuring I'll use the feature to create the class models based on the DB, once I get the DB in place. 另外,我想一旦将数据库安装好后,我将使用该功能基于数据库创建类模型。 Please let me know if this is probably the best route to go, or if you foresee any problems with this approach. 请让我知道这是否可能是最好的方法,或者您预见到此方法有任何问题。

I've checked other questions on SO, but none of the similar questions (including How to move models to separate project .NET MVC ) I found really answered my question. 我已经检查了SO上的其他问题,但是没有找到类似的问题(包括如何将模型移动到单独的项目.NET MVC ),我发现它确实回答了我的问题。 I also Googled it and found http://msdn.microsoft.com/en-us/library/ms345408.aspx , and it looks like the info is there (maybe), but I don't understand all the terminology well enough to have confidence to start messing with things...I really don't want to lose the previous work because I made poor assumptions. 我还用Google搜索了它,发现http://msdn.microsoft.com/en-us/library/ms345408.aspx ,看起来好像有信息了(也许),但是我对所有术语的理解都不尽如人意有信心开始弄乱事情...我真的不想丢掉以前的工作,因为我做错了假设。 Thanks in advance! 提前致谢!

Just copy and paste the database, you can do it directly from the folder 只需复制和粘贴数据库,即可直接从文件夹中进行操作

Use the same connection string, it could be that you only have to change the path to your DB 使用相同的连接字符串,可能只需要更改数据库的路径即可

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我的ASP.NET MVC项目未获取我的SQL Server Express值 - My ASP.NET MVC project is not retrieving my SQL Server Express values 如何在ASP.NET Core项目中指向我的完整SQL Server Express数据库? - How do I point to my full SQL Server Express database in ASP.NET Core project? 新的ASP.NET MVC 4项目上的异常 - Exception on new ASP.NET MVC 4 project 使用旧BLL层的新Asp.Net MVC项目(类+ ado.net + SP) - New Asp.Net MVC Project using Old BLL layer (classes + ado.net + SP) 新的ASP.Net MVC项目的体系结构 - Architecture for new ASP.Net MVC Project 将ASP.NET MVC项目部署到服务器 - Deploying an ASP.NET MVC project to server 如何将SQL Server CE用于我的ASP.net MVC成员/授权项目? - How can I use SQL Server CE for my ASP.net MVC membership/authorization project? 如何将 ASP.NET Core 5 MVC 项目连接到 Supabase 数据库而不是 SQL 服务器? - How to connect ASP.NET Core 5 MVC project to Supabase database instead of SQL Server? 如何在默认的asp.net mvc项目中将值插入SQL Server中的现有行? - How do I insert values into existing rows in SQL server in default asp.net mvc project? 使用另一个C#项目连接到ASP.NET SQL Express数据库 - Connect to an ASP.NET SQL express db with another C# Project
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM