将MSSQL数据库导出到MS Access .accdb文件 [英] Export MSSQL database to MS Access .accdb file

查看:360
本文介绍了将MSSQL数据库导出到MS Access .accdb文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Microsoft SQL Server数据库,该数据库会定期更新数据.我想使用C#将所有表(最好是关系)的数据库存储到新的Microsoft Access(.accdb)文件中.

I have a Microsoft SQL Server database which is updated with data regularly. I would like to store this database with all tables (and preferrably relationsships) to a new Microsoft Access (.accdb) file using C#.

SQL Management Studio已安装在系统上,因此我认为一种解决方案可以是调用BCP(

SQL Management Studio is installed on the system so I think one solution could be to invoke BCP (http://msdn.microsoft.com/en-us/library/ms162802.aspx) from the code, but I haven't figured out how to use it correctly in this case. I guess there are much better ways doing it without using BCP though.

任何人都可以推荐实现这一目标的方法吗?

Can anyone recommend a way to achieve this?

谢谢

推荐答案

您可以在Access中导入MSSQL数据.有关更多信息:

You can import MSSQL Data in Access; More info on: http://office.microsoft.com/en-us/access-help/import-or-link-to-sql-server-data-HA010200494.aspx

更新:

或者,您可以使用sqldataadapter选择所有表以将所有内容存储在数据集中,请参见:

Alternately you can select all tables using sqldataadapter to store everything in a dataset, see: Obtaining a dataset from a SQL Server database

从那里可以将数据集另存为访问数据库文件,请参见: C#访问数据库的数据集

From there on you can save the dataset as a access database file, see: C# Dataset to Access DB

也许这更符合您的问题.

Maybe this is more inline with your problem.

这篇关于将MSSQL数据库导出到MS Access .accdb文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆