- ODBC Drivers
- Java JDBC Drivers
- ADO.NET Providers
- SQL SSIS Components
- BizTalk Adapters
- Excel Add-Ins
- Power BI Connectors
- Tableau Connectors
- PowerShell Cmdlets
- Delphi & C++Builder
- Data Sync
- API Server
Visual Studio でチャートコントロールと Business b-ridge をデータバインド
標準ADO.NET プロシージャを使ってデータバインドして、Visual Studio ツールボックスのコントロールから Business b-ridge との双方向接続を実現。この記事ではVisual Studio のグラフィカルアプローチと、ほんの数行のコードでデータバインドをする方法を説明します。データバインドによって、UI コントロールからデータに接続できます。 CData ADO.NET Provider for Business b-ridge を使って、Visual Studio 上でWindows Forms およびWeb Forms とBusiness b-ridge をデータバインドできます。この記事で、Business b-ridge を、ウィザードから変更をリアルタイムで反映するチャートにデータバインドする方法を説明します。 Code Walk-through セクションではチャートはほんの10行のコードで作成します。
チャートへのデータバインド
データバインドは3つのステップから構成されます;コントロールのインスタンス作成、データソースの設定、データバインドです。
接続を設定してデータベースオブジェクトを選択
下の手続きにより、データソース構成ウィザードを使ってチャートコントロールとBusiness b-ridge との接続を作成します。ウィザード上でデータバインドをするBusiness b-ridge エンティティを使います。
- Windows Forms プロジェクトでは、チャートコントロールをツールボックスからフォーム上にドラグ&ドロップします。チャートプロパティのデータセクションで DataSource を選択し、メニューからプロジェクトデータソースの追加を選択します。
- 出てくるデータソース構成ウィザードでデータベース -> データセットを選択します。
- データ接続ステップで、「新しい接続」をクリックします。
データ接続の選択ダイアログで、「変更」をクリックして、CData Business b-ridge データソースを選択して、接続プロパティを入力します。下は代表的な接続文字列ですです。:
When connecting to Business b-ridge, CompanyKey, ProjectKey, and SubscriptionKey are required.
To obtain the SubscriptionKey, follow the steps below:
- Log in to Business b-ridge API Protal and go to "Profile" in the "Your name" menu.
- In your subscription section click "Main Key" to retrieve their respective values.
Authenticate to Business b-ridge Account
Set the following connection properties to connect:
- CompanyKey: Set the Business b-ridge Company Key of the connection destination.
- ProjectKey: Set the Business b-ridge Project Key of the connection destination.
- SubscriptionKey: Set the value "Subscription Key".
- 使用するデータソースオブジェクトを選択します。例は CDATA テーブルです。

DataBind
データソースの追加とデータベースオブジェクトを選択したら、チャートにオブジェクトをバインドします。この例では、X軸に ItemId をY軸に StructureId を設定します。
- チャートプロパティで、Series プロパティをクリックし、Series コレクション エディター を開きます。
- Series プロパティでX軸、Y軸に設定するカラムを選択します:XValueMember および YValueMember プロパティにメニューからカラムを選びます。

チャートはこれでBusiness b-ridge にデータバインドされました。チャートを実行して最新のデータを表示させましょう。
コード Walk-through
Business b-ridge へのデータバインドはほんの数行のコードのみが必要で、3つの簡単なステップで完了できます。
- Business b-ridge に接続します。
- BusinessBridgeDataAdapter を作成して、クエリを作成し、結果を入れるデータセットを作成します。
- 結果セットとチャートをデータバインドします。
下に完全なコードを示します:
BusinessBridgeConnection conn = new BusinessBridgeConnection("");
BusinessBridgeCommand comm = new BusinessBridgeCommand("SELECT ItemId, StructureId FROM CDATA WHERE ItemTypeId = '1'", conn);
BusinessBridgeDataAdapter da = new BusinessBridgeDataAdapter(comm);
DataSet dataset = new DataSet();
da.Fill(dataset);
chart1.DataSource = dataset;
chart1.Series[0].XValueMember = "ItemId";
chart1.Series[0].YValueMembers = "StructureId";
// Insert code for additional chart formatting here.
chart1.DataBind();