简体   繁体   English

从Access迁移到SQL Server数据库

[英]Migrating from Access to SQL Server database

I have produced a small program that uses a database created in MS Access. 我制作了一个小程序,使用了在MS Access中创建的数据库。 I have created about 5 queries for the database to test it and everything is working fine. 我已经为数据库创建了约5个查询来对其进行测试,并且一切正常。 I want to learn something new, so I decided to improve my program by migrating DB to SQL Server, but I don't really know where to start from. 我想学习一些新知识,因此我决定通过将DB迁移到SQL Server来改进程序,但是我真的不知道从哪里开始。 I have installed MS SQL Server 2012 and looking for some tutorials/pointers for beginners. 我已经安装了MS SQL Server 2012,并正在为初学者寻找一些教程/指针。 My initial goals are: 我的最初目标是:

  • Convert MS Access database to SQL Server 将MS Access数据库转换为SQL Server

I believe that the up-size wizard included in MS Access can be sufficient for the job. 我相信MS Access中包含的大型向导足以完成这项工作。 Am I right? 我对吗?

  • Connect my C# program to DB saved on SQL Server 将我的C#程序连接到保存在SQL Server上的数据库

I think that I should edit my connection string and replace OleDb with something else... What should it be? 我认为我应该编辑我的连接字符串,并用其他东西替换OleDb ...那应该是什么?

I am not sure if the tool exists also for Sql Server 2012 but in 2008 R2 you have a menu entry in the Program Group for Sql Server called Data Import Export (32bit) (Translated from my localization, hope to be near at the exact thing) that could be used to port an MS Access Database to a SQL Server. 我不确定该工具是否也适用于Sql Server 2012,但在2008 R2中,您在Sql Server程序组中有一个菜单项,称为Data Import Export (32bit) (从我的本地化翻译而来,希望能在确切的地方找到) ),可用于将MS Access数据库移植到SQL Server。 Of course you need install Sql Server Management Studio to manage the fine details of your new database. 当然,您需要安装Sql Server Management Studio来管理新数据库的详细信息。

For the code part (connection string) you could continue to use OleDb changing only the connection string (see here at www.connectionstrings.com ), but your best option is to change everything and use the classes in the namespace System.Data.SqlClient like SqlConnection instead of OleDbConnection, SqlCommand instead of OleDbCommand and so on.... 对于代码部分(连接字符串),您可以继续使用OleDb仅更改连接字符串(请参见此处, 网址www.connectionstrings.com ),但是最好的选择是更改所有内容并使用名称空间System.Data.SqlClient的类。例如SqlConnection而不是OleDbConnection,SqlCommand而不是OleDbCommand等等。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM