Ready to get started?

Learn more about the CData ADO.NET Provider for HPCC or download a free trial:

Download Now

DataBind HPCC Systems Data to the DevExpress Data Grid

Use the CData ADO.NET Provider for HPCC Systems with the DevExpress Windows Forms and Web controls to provide HPCC Systems data to a chart.

The CData ADO.NET Provider for HPCC Systems implements standard ADO.NET data access components that can be used with third-party controls. The standard ADO.NET process for databinding can be followed to enable bidirectional access to live data from UI controls. In this article we show how to use the CData components to databind to the DevExpress Windows Forms and Web controls; you will databind to a chart that displays current data.

To connect, set the following connection properties: Set URL to the machine name or IP address of the server and the port the server is running on, for example, https://server:port. The User and Password are required to authenticate to the HPCC Systems cluster specified in the URL. Note that LDAP authentication is not currently supported by our ODBC driver.

Set Version to the WsSQL Web server version. Note that if you have not already done so, you will need to install the WsSQL service on the HPCC Systems server. The WsSQL Web service is used to interact with the underlying HPCC Systems platform.

Set Cluster to the target cluster.

Windows Forms Controls

The code below shows how to populate a DevExpress chart with HPCC Systems data. The HPCCDataAdapter binds to the Series property of the chart control. The Diagram property of the control defines the x- and y-axes as the column names.

using (HPCCConnection connection = new HPCCConnection( "URL=http://127.0.0.1:8510;User=test;password=xA123456;Version=1;Cluster=hthor;")) { HPCCDataAdapter dataAdapter = new HPCCDataAdapter( "SELECT SUM(hpcc::test::orders.Price), hpcc::test::customers.CustomerName FROM hpcc::test::orders INNER JOIN hpcc::test::customers ON hpcc::test::orders.CustomerId=hpcc::test::customers.CustomerId;GROUP BY hpcc::test::customers.CustomerName", connection); DataTable table = new DataTable(); dataAdapter.Fill(table); DevExpress.XtraCharts.Series series = new DevExpress.XtraCharts.Series(); chartControl1.Series.Add(series); series.DataSource = table; series.ValueDataMembers.AddRange(new string[] { "Price" }); series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative; series.ArgumentDataMember = "CustomerName"; series.ValueScaleType = DevExpress.XtraCharts.ScaleType.Numerical; chartControl1.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; }

Web Controls

The code below shows how to populate a DevExpress Web control with HPCC Systems data. The HPCCDataAdapter binds to the Series property of the chart; the Diagram property defines the x- and y-axes as the column names.

using DevExpress.XtraCharts; using (HPCCConnection connection = new HPCCConnection( "URL=http://127.0.0.1:8510;User=test;password=xA123456;Version=1;Cluster=hthor;")) { HPCCDataAdapter HPCCDataAdapter1 = new HPCCDataAdapter("SELECT SUM(hpcc::test::orders.Price), hpcc::test::customers.CustomerName FROM hpcc::test::orders INNER JOIN hpcc::test::customers ON hpcc::test::orders.CustomerId=hpcc::test::customers.CustomerId;GROUP BY hpcc::test::customers.CustomerName", connection); DataTable table = new DataTable(); HPCCDataAdapter1.Fill(table); DevExpress.XtraCharts.Series series = new Series("Series1", ViewType.Bar); WebChartControl1.Series.Add(series); series.DataSource = table; series.ValueDataMembers.AddRange(new string[] { "Price" }); series.ArgumentScaleType = ScaleType.Qualitative; series.ArgumentDataMember = "CustomerName"; series.ValueScaleType = ScaleType.Numerical; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; }
 
 
ダウンロード