0

我在 Visual Studio 中创建了一个基于 vb.net 的 windows 窗体项目。此表单充当数据库的前端。

这次我决定尝试使用 Visual Studio 中的数据集设计器,发现它很方便。使用向导我链接了 MS Access 数据库以在项目中创建数据集。然后自动生成所有相关的表适配器、数据集、绑定源等。

现在,目标是将相同的 Access 数据库转换为 SQL 服务器。 问题是是否可以简单地将 Visual Studio 中的数据集从 Access 交换到具有相同表名、结构、关系的 SQL ......我尝试修改 Settings.settings 中的连接字符串但没有成功。

这将为我节省大量时间,无需遍历每个对象并将数据源更新到新的 SQL 数据库。

4

1 回答 1

0

You should be able to establish a separate connection to sql server using ado. You can find typical connection strings easily: try http://www.connectionstrings.com/microsoft-ole-db-provider-for-sql-server-sqloledb/ for example. If the tables exist in sql server, you can SELECT from Access and INSERT into SSvr using 2 different connections, 2 sql command objects. If you have trouble with the SQL (which is very possible, I have not done this with Access), create a dataset from the Access SELECT and use that as an intermediate step. If the tables do not exist yet, get the script for CREATE TABLE in Access or in SSMS, and execute that before doing the SELECT/INSERT operation.

于 2014-09-24T22:10:39.657 回答