Readme_LOB Handling Using ADO.NET Sample
[このトピックはプレリリース版のドキュメントであり、今後のリリースでは変更される場合があります。空のトピックがプレースホルダとして含まれています。]
このサンプルは、SQL Server 2005 および SQL Server 2008 でのみ動作します。SQL Server 2005 より前のバージョンでは動作しません。
The LOB_ADONet sample programmatically reads binary data from a file and stores the contents into a database. This sample also retrieves binary data stored in the database and writes the contents to a file.
Default Location: C:\Program Files\Microsoft SQL Server\100\Samples\Engine\Data Access\ADO\Handling LOB using ADONetScenario
SQL Server samples and sample databases must be downloaded and installed before you can view or work with them. For more information, see SQL Server のサンプルとサンプル データベースのインストールに関する注意点.
Languages
Transact-SQL, ADO.NET
Prerequisites
Before you run this sample, make sure the following software is installed:
- SQL Server or SQL Server Express. You can obtain SQL Server Express free of charge from this Microsoft Web site.
- The AdventureWorks database which is included with SQL Server, and is also available at the Microsoft SQL Server Developer Center.
- The SQL Server データベース エンジン samples. These samples are included with SQL Server. You can download the latest version of the samples at the Microsoft SQL Server Developer Center.
- .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. For more information, see .NET Framework SDK のインストール.
Building the Sample
強力な名前のキー ファイルをまだ作成していない場合は、次の指示に従ってキー ファイルを生成してください。
強力な名前のキー ファイルを生成するには
Microsoft Visual Studio 2005 コマンド プロンプトを開きます。[スタート] メニューの [すべてのプログラム] をポイントし、[Microsoft .NET Framework SDK 2.0] をポイントします。次に、[SDK コマンド プロンプト] をクリックします。
または
Microsoft .NET Framework コマンド プロンプトを開きます。[スタート] メニューの [すべてのプログラム] をポイントし、[Microsoft .NET Framework SDK 2.0] をポイントします。次に、[SDK コマンド プロンプト] をクリックします。
コマンド プロンプト ウィンドウでディレクトリの移動コマンド (CD) を使用して、現在のディレクトリからサンプルがインストールされているフォルダまで移動します。
注 : サンプルが保存されているフォルダを特定するには、[スタート] ボタンをクリックし、[すべてのプログラム] をポイントして、[Microsoft SQL Server] をポイントします。次に、[マニュアルとチュートリアル] をポイントし、[サンプル ディレクトリ] をクリックします。既定のインストール場所を使用している場合、サンプルは <system_drive>:\Program Files\Microsoft SQL Server\100\Samples にあります。 コマンド プロンプトで次のコマンドを実行してキー ファイルを生成します。
sn -k SampleKey.snk
重要 : 強力な名前のキー ペアの詳細については、MSDN にある .NET Development Center の「Security Briefs: Strong Names and Security in the .NET Framework」を参照してください。
To build the sample, you must do the following:
To build the sample
In SQL Server Management Studio, load and execute the Scripts\install.sql script or execute the following command in a Command Prompt window:
sqlcmd -E -I -i Scripts\installCS.sql
This script creates the following:
- usp_InsertDocument stored procedure
- usp_GetDocumentByID stored procedure
Build the application by using Visual Studio 2005 or type the following in a Command Prompt window:
msbuild /nologo /verbosity:quiet /property:Configuration=Debug CS\Handling LOB using ADONet\Handling LOB using ADONet.csproj
msbuild /nologo /verbosity:quiet /property:Configuration=Debug VB\Handling LOB using ADONet\Handling LOB using ADONet.vbproj
Running the Sample
To run the sample
Run bin\Release\handling_lob_using_adonet.exe (or bin\Debug\handling_lob_using_adonet.exe). Optionally, you can provide the input file name, output file name and the database server name. The default values for input parameters are:
- String currentDirectory =
Directory.GetCurrentDirectory() + @"\";
- String inFileName =
"testdoc.doc";
- String outFileName =
"docout.doc";
- String dataSource =
"localhost";
- String currentDirectory =
In the Command Prompt window, type:
handling_lob_using_adonet /in:.\DataFiles\testdoc.doc /out:otestdoc.doc
メモ : The default current directory will be .\bin\debug. If you run the sample from Visual Studio, you may have to move testdoc.doc to this directory.
Comments
This sample reads data from the testdoc.doc input file into the Document table in the AdventureWorks sample database. The sample retrieves data from the Document table and reads it into the docout.doc output file.
メモ : |
---|
By default, the test.doc input file is in the Data Files folder, and the docout.doc output file is written to the Application Data folder. |