![]() |
VOOZH | about |
DataBinding facilitates two-way interaction with data through UI controls. Using the CData ADO.NET Provider for QuickBooks Online streamlines the process of binding QuickBooks Online data to Windows Forms and Web controls within Visual Studio. In this article, we will demonstrate using wizards to establish a binding between QuickBooks Online data and a chart that dynamically updates. Additionally, the code walk-through section will guide you through the creation of a chart using just 10 lines of code.
CData provides the easiest way to access and integrate live data from QuickBooks Online. Customers use CData connectivity to:
Many users access live QuickBooks Online data from preferred analytics tools like Power BI and Excel, directly from databases with federated access, and use CData solutions to easily integrate QuickBooks Online data with automated workflows for business-to-business communications.
For more information on how customers are solving problems with CData's QuickBooks Online solutions, refer to our blog: https://www.cdata.com/blog/360-view-of-your-customers.
DataBinding to a Chart consists of three steps: Instantiate the control, configure the data source, and databind.
To create a chart control and establish a connection to QuickBooks Online, follow the steps outlined below using the Data Source Configuration Wizard. Within the wizard, you'll have the option to choose the specific QuickBooks Online entities you wish to bind to.
In the Add Connection dialog, click Change to select the CData QuickBooks Online Data Source.
Below is a typical connection string:
InitiateOAuth=GETANDREFRESH;
QuickBooks Online uses the OAuth authentication standard. OAuth requires the authenticating user to log in through the browser. To authenticate using OAuth, you can use the embedded OAuthClientId, OAuthClientSecret, and CallbackURL or you can obtain your own by registering an app with Intuit. Additionally, if you want to connect to sandbox data, set UseSandbox to true.
See the Getting Started chapter of the help documentation for a guide to using OAuth.
When you configure the connection, you may also want to set the Max Rows connection property. This will limit the number of rows returned, which is especially helpful for improving performance when designing reports and visualizations.
๐ Connection properties for the selected data source in the Add Connection dialog. (Salesforce is shown.)After adding the data source and selecting database objects, you can bind the objects to the chart. This example assigns the x-axis to DisplayName and the y-axis to Balance.
The chart is now databound to the QuickBooks Online data. Run the chart to display the current data.
๐ The chart, filled with data at run time.
DataBinding to QuickBooks Online data requires only a few lines of code and can be completed in three easy steps.
Below is the complete code:
QuickBooksOnlineConnection conn = new QuickBooksOnlineConnection("InitiateOAuth=GETANDREFRESH;");
QuickBooksOnlineCommand comm = new QuickBooksOnlineCommand("SELECT DisplayName, Balance FROM Customers", conn);
QuickBooksOnlineDataAdapter da = new QuickBooksOnlineDataAdapter(comm);
DataSet dataset = new DataSet();
da.Fill(dataset);
chart1.DataSource = dataset;
chart1.Series[0].XValueMember = "DisplayName";
chart1.Series[0].YValueMembers = "Balance";
// Insert code for additional chart formatting here.
chart1.DataBind();
Download a free trial of the QuickBooks Online Data Provider to get started:
Download NowLearn more:
๐ QuickBooks Online IconComplete read-write access to QuickBooks Online enables developers to search (Customers, Transactions, Invoices, Sales Receipts, etc.), update items, edit customers, and more, from any .NET application.