简体   繁体   English

如何将在 Visual Studio C# 中创建的数据库迁移到 SQL 服务器?

[英]How to migrate a DataBase created in Visual Studio C# to a SQL Server?

I want to transfer/connect my database that I created in Visual Studio C# to SQL Server Management Studio 2016. I'm developing Hotel Management Software and my database is relative short and I don't have the time to create a new one because of all the code included in my program related to the database.我想将我在 Visual Studio C# 中创建的数据库传输/连接到 SQL Server Management Studio 2016。我正在开发酒店管理软件,我的数据库相对较短,我没有时间创建一个新的,因为我的程序中包含的所有与数据库相关的代码。 I only have one DataSet and three tables.我只有一个 DataSet 和三个表。 I'm using Windows Authentication but I need to use SQL Server Authentication but I don't know to do that.我正在使用 Windows 身份验证,但我需要使用 SQL 服务器身份验证,但我不知道该怎么做。

I'll appreciate all the answers to my question.我会很感激我的问题的所有答案。

I figured out how to do it.我想出了怎么做。

First was getting acess to my DataBase.mdf file, so I changed my program path to a "PUBLIC" folder.首先是访问我的 DataBase.mdf 文件,因此我将程序路径更改为“PUBLIC”文件夹。 My was in the USERS and I changed it to C:/ path.我在用户中,我将其更改为 C:/ 路径。 Then in SQL Server Management, I entered with Windows Authentication first, then I went to "Databases" folder, right cliked, choose Attach, chosse Add, and I connected my Database.mdf in C:/ path.然后在 SQL 服务器管理中,我先用 Windows Authentication 进入,然后我进入“Databases”文件夹,右键单击,选择 Attach,选择 Add,然后我在 Z0D61F8:370CAD1D4125D7 中连接了我的 Database.mdf:370CAD1D4125D7 After connection, I went to Security, right clicked Login and added a new login.连接后,我去安全,右键单击登录并添加一个新的登录。 Now I can acess with SQL Server Authentication.现在我可以使用 SQL 服务器身份验证访问。

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

相关问题 如何在SQL Server Management Studio中使用Visual Studio创建连接数据库? - How connect database created in SQL Server Management Studio with Visual Studio? C#Visual Studio违反PK for SQL Server数据库 - C# Visual Studio violation of PK for SQL Server database 通过 Visual Studio 上 C# 中的 datagridview 更新 SQL 服务器数据库 - Update SQL Server database via a datagridview in C# on Visual Studio 使用C#连接到SQL Server 2012数据库(Visual Studio 2012) - Connect to SQL Server 2012 Database with C# (Visual Studio 2012) Microsoft SQL Server 数据库/Visual Studio C#:日期处理 - Microsoft SQL Server database / Visual Studio C# : date handling 在Visual Studio 2012 C#中连接到SQL Server数据库 - Connection to SQL Server Database inside Visual Studio 2012 C# Visual Studio 中的数据库问题(c# 和 SQL 服务器) - Database problem in visual studio (c# and SQL Server) 如何在Visual Studio 2015中使用C#创建到SQL Server数据库的连接字符串 - How to create a connection string using C# to SQL Server database in Visual Studio 2015 如何在Visual Studio 2017中从C#代码制作SQL Server 2017本地数据库? - How to make a SQL Server 2017 local database from C# code in Visual Studio 2017? 如何在Visual Studio(C#)中将ASP.NET项目与SQL Server数据库表连接 - How to connect ASP.NET project with SQL Server database table in Visual Studio (C#)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM