製品をチェック

Dynamics 365 Business Central Data Provider の30日間無償トライアルをダウンロード

 30日間の無償トライアルへ

製品の詳細

Dynamics 365 Business Central (NAV) アイコン Dynamics 365 Business Central ADO.NET Provider 相談したい

Items、Sales Orders、Purchase Orders などのDynamics 365 Business Central データを組み込んだパワフルな.NET アプリケーションを短時間・低コストで作成して配布できます。

Dynamics 365 Business Central データをDevExpress Data Grid にデータバインドする。

Dynamics 365 Business Central 用の CData ADO.NET プロバイダーをDevExpress Windows Forms とWeb コントロールとともに使用し、Dynamics 365 Business Central をチャートに入力します。

加藤龍彦
ウェブデベロッパー

最終更新日:2022-01-31
d365businesscentral ロゴ

CData

ado ロゴ画像
DevExpress ロゴ

こんにちは!ウェブ担当の加藤です。マーケ関連のデータ分析や整備もやっています。

Dynamics 365 Business Central 用の CData ADO.NET プロバイダーはサードパーティーコントロールで使うことのできる通常のADO.NET データベースアクセスコンポーネントを実装しています。データバインドするための通常のADO.NET プロセスに従うことで、UI コントロールから実データへの双方向アクセスを可能にします。 この記事では、CData を使ってDevExpress Windows Forms とウェブコントロールにデータバインドする方法を説明します。ここでは、最新のデータを表示するチャートにデータバインドします。

Dynamics 365 Business Central 接続プロパティの取得・設定方法

Dynamics 365 Business Central への認証には、User およびAccessKey プロパティが必要です。

データに接続するには、OrganizationUrl を指定します。OrganizationUrl は、 http://businesscentral.dynamics.com/abc123/ などのBusiness Central アカウントへのエンドポインであるか、Web サービスのルートを参照する必要があります。OrganizationUrl を指定する方法 および利用可能なエンドポイントについての詳細は、Business Central エンドポイント を参照してください。組織内に複数の会社がある場合は、どの会社に接続するかを特定するためにCompany を指定する必要があります。 会社が1つだけの場合は、Company を指定する必要はありません。

Dynamics 365 Business Central に認証するには、User およびAccessKey 接続プロパティを指定します。Microsoft では、これらをテストおよび開発目的で推奨します。ただし、運用環境での使用は推奨していません。User およびAccessKey の値を取得するには、Dynamics 365 Business Central の「ユーザー」ページに移動して「編集」をクリックします。User Name および Web Service Access Key の値は、User およびPassword 接続文字列プロパティとして入力する値です。User Name はE メールアドレス ではありません。短縮されたユーザー名です。

Microsoft では、OAuth 認証を使用する本番ユースケースを推奨します。詳細については、ヘルプドキュメントの「OAuth 認証の使用」を参照してください。

Windows Forms コントロール

下のコードでは、Dynamics 365 Business Central でDevExpress のチャートに追加する方法を説明します。D365BusinessCentralDataAdapter はチャートコントロールのSeries プロパティにバインドします。コントロールのDiagram プロパティはx 軸とy 軸をカラム名として定義します。

using (D365BusinessCentralConnection connection = new D365BusinessCentralConnection( "OrganizationUrl=https://myaccount.financials.dynamics.com/;")) { D365BusinessCentralDataAdapter dataAdapter = new D365BusinessCentralDataAdapter( "SELECT accountid, Name FROM Accounts", connection); DataTable table = new DataTable(); dataAdapter.Fill(table); DevExpress.XtraCharts.Series series = new DevExpress.XtraCharts.Series(); chartControl1.Series.Add(series); DataTable table = new DataTable(); series.ValueDataMembers.AddRange(new string[] { "Name" }); series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative; series.ArgumentDataMember = "accountid"; series.ValueScaleType = DevExpress.XtraCharts.ScaleType.Numerical; chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; } The complete code example and the resulting chart.

Web コントロール

下のコードではDynamics 365 Business Central でDevExpress Web を操作するための設定方法を説明します。D365BusinessCentralDataAdapter はチャートのSeries プロパティにバインドします。Diagram プロパティはx 軸とy 軸をカラム名として定義します。 using DevExpress.XtraCharts; using (D365BusinessCentralConnection connection = new D365BusinessCentralConnection( "OrganizationUrl=https://myaccount.financials.dynamics.com/;")) { D365BusinessCentralDataAdapter D365BusinessCentralDataAdapter1 = new D365BusinessCentralDataAdapter("SELECT accountid, Name FROM Accounts", connection); DataTable table = new DataTable(); D365BusinessCentralDataAdapter1.Fill(table); DevExpress.XtraCharts.Series series = new Series("Series1", ViewType.Bar); WebChartControl1.Series.Add(series); DataTable table = new DataTable(); series.ValueDataMembers.AddRange(new string[] { "Name" }); series.ArgumentScaleType = ScaleType.Qualitative; series.ArgumentDataMember = "accountid"; series.ValueScaleType = ScaleType.Numerical; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; } An ASP.NET application created with the ADO.NET Provider and the DevExpress Web Forms control.(Salesforce is shown.)

関連コンテンツ

トライアル・お問い合わせ

30日間無償トライアルで、CData のリアルタイムデータ連携をフルにお試しいただけます。記事や製品についてのご質問があればお気軽にお問い合わせください。