Ready to get started?

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

Download Now

DataBind Btrieve Data to the DevExpress Data Grid

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

The CData ADO.NET Provider for Btrieve 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.

The PSQL v13 client will need to be installed on the same machine as the driver. To connect, set the User, Password, Server, and Database properties.

Windows Forms Controls

The code below shows how to populate a DevExpress chart with Btrieve data. The BtrieveDataAdapter 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 (BtrieveConnection connection = new BtrieveConnection( "User=myuser;Password=mypassword;Server=myserver;Database=mydatabase")) { BtrieveDataAdapter dataAdapter = new BtrieveDataAdapter( "SELECT Student_ID, Transaction_Number FROM Billing", 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[] { "Transaction_Number" }); series.ArgumentScaleType = DevExpress.XtraCharts.ScaleType.Qualitative; series.ArgumentDataMember = "Student_ID"; 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 Btrieve data. The BtrieveDataAdapter 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 (BtrieveConnection connection = new BtrieveConnection( "User=myuser;Password=mypassword;Server=myserver;Database=mydatabase")) { BtrieveDataAdapter BtrieveDataAdapter1 = new BtrieveDataAdapter("SELECT Student_ID, Transaction_Number FROM Billing", connection); DataTable table = new DataTable(); BtrieveDataAdapter1.Fill(table); DevExpress.XtraCharts.Series series = new Series("Series1", ViewType.Bar); WebChartControl1.Series.Add(series); series.DataSource = table; series.ValueDataMembers.AddRange(new string[] { "Transaction_Number" }); series.ArgumentScaleType = ScaleType.Qualitative; series.ArgumentDataMember = "Student_ID"; series.ValueScaleType = ScaleType.Numerical; ((DevExpress.XtraCharts.SideBySideBarSeriesView)series.View).ColorEach = true; }
 
 
ダウンロード