【解決方法】Sql サーバー 2019: VB.NET を使用して既存の ACCESS-DB にテーブルをコピーする

プログラミングQA


こんにちは。

SQL Server DB から既存の ACCESS DB にテーブルをコピーまたはエクスポートするにはどうすればよいですか?
ADO または ADO.NET を使用します。

ご協力いただき誠にありがとうございます。

私が試したこと:

OBBC DSN を使用しようとしました。 成功せずに。

解決策 1

Microsoftのチュートリアルに従って ここ、次の操作を実行して、Sql Server から Access にデータベースをインポートできます –

注: データをインポートすると、Access はデータの 1 回限りのコピーを作成するため、インポート後に Access または SQL データベースでデータに加えられた変更は同期されません。

1.インポートするには –

Select External Data > New Data Source > From Database > From SQL Server.
In the Get External Data – ODBC Database dialog box select Import the source data into a new table in the current database.

Select OK.

2. DSN ファイルを作成または再利用する

You can create a DSN file or reuse an existing one. Use a DSN file when you want to rely on the same connection information for import operations or to share with a different application that also uses DSN files. You can create a DSN file directly by using the Data Connection Manager.

1. If the DSN file you want to use already exists, select it from the displayed list. Depending on which authentication method you entered in the connection information, you may need to enter a password again.
2. To create a new DSN file:
-Select New.
-Select ODBC Driver for SQL Server, and then select Next.
-Enter a name for the DSN file, or click Browse to create the file in a different location.
-Click Next to review the summary information, and then click Finish.

3. SQL Server ウィザードへの新しいデータ ソースの作成を使用します。

In the Create a New Data Source to SQL Server wizard, do the following:
-On page one, enter identification information:
---In the Description box, optionally enter documentary information about the DSN file.
---In the Server box, enter the name of the SQL Server. Do not click the down arrow.

-On page two, select one of the following authentication methods:
---With Integrated Windows authentication    Connect through a Windows user account, OR
---With SQL Server authentication…    Connect with credentials that have been set up in the database by entering the login ID and password.

-On pages three and four, select various options to customize your connection.
-A screen appears to confirm your settings. Select Test Data Source to confirm your connection.
-You may need to login to the database. In the SQL Server Login dialog box, enter the login ID and password. To change additional settings, select Options.

4. リンク先またはインポート元のテーブルとビューを選択します

1. In the Link Tables or Import Objects dialog box, under Tables, select each table or view that you want to link or import, and then click OK.
2. In a link operation, decide whether to select Save Password.
3. Security -
---Selecting this option eliminates the need to enter credentials each time you open Access and access the data. But, this stores an unencrypted password in the Access database, which means people who can access the source contents can see the user name and password.

5. 仕様とタスクを作成する

In the Get External Data - ODBC Database dialog box, you can save the import steps as a specification and create an Outlook task to automate the import operation on a regular basis.

6. 最終結果 –

When an import operation completes, the tables appear in the Navigation Pane with the same name as the SQL Server table or view combined with the owner name.
Access never overwrites a table in the database. Although you cannot directly append SQL Server data to an existing table, you can create an append query to append data after you have imported data from similar tables.

行き詰まった場合は、提供されたリンクを参照して、手順を 100% 実行したことを確認してください。

コメント

タイトルとURLをコピーしました