Connect to QuickBooks From LightSwitch Applications

The CData Data Providers for ADO.NET enable you to integrate disparate data sources into LightSwitch applications. In this demo, you will create a LightSwitch application that connects with QuickBooks Desktop and displays account data in an editable grid. Any changes will be immediately reflected in QuickBooks. The procedure outlined below can be used with any CData ADO.NET Data Providers.

Create a QuickBooks Data Source and Import Tables

Follow the steps below to configure connection properties and import tables in the Data Source Configuration wizard.

  1. Open Visual Studio and create a new LightSwitch Project.
  2. In a new LightSwitch Project, click 'Attach to External Data Source'.
  3. In the wizard that appears, select Database. The Add Connection dialog is displayed.
  4. Click Change to select the CData QuickBooks Data Source.
  5. Enter the connection details for your QuickBooks machine. In this example, QuickBooks is hosted on a separate machine.

    To connect to remote and local desktop editions of QuickBooks, use the Remote Connector application installed with the application. Use the URL, User, and Password connection properties to connect to the Remote Connector. The Remote Connector is a lightweight, stand-alone server. It is used to connect your application to QuickBooks in situations where direct COM access to QuickBooks is not available (e.g., ASP.NET, Java, or a company file on a remote machine). For more information and a step-by-step guide to establish a connection, refer to the "Getting Started" guide in the help documentation.

    Set the CacheLocation and CacheMetadata properties to improve performance. The performance gained from caching data is especially relevant in LightSwitch projects, as creating the entity model requires data about every table and column. Cache the metadata before connecting to QuickBooks so that LightSwitch can pull the table schemas from the cache instead of sending a query for every table.

    You will also need to set "AllowReadOnlyColumnsInUpdate=True;" in the Other property. By setting this property, you can avoid an error when you update from an Editable Grid. When you save changes in an Editable Grid, LightSwitch submits all fields, including read-only fields.

  6. Select the tables and views you would like to add to the project.

Create a Screen

Follow the steps below to add an editable grid and associate it with QuickBooks tables.

  1. In Solution Explorer, right-click the Screens folder and click Add Screen.
  2. In the resulting wizard, select the Editable Grid screen template.
  3. In the Screen Data menu, select which table or view to associate with the screen. This example uses the Accounts table.
  4. Run the LightSwitch application. The screen will automatically execute and populate with data.

LightSwitch Sample Project

To get started with using the QuickBooks provider in LightSwitch, you can use the sample project. The sample project is available for Visual Studio 2010 and Visual Studios 2012, 2013, and 2015.

You will also need the QuickBooks ADO.NET Data Provider. You can download a free trial from

Note: Before running the demo, you will need to change your connection details. Right-click on the QuickBooks Desktop Data Source and click Update Data Source. In the resulting wizard, click the Previous button and enter the connection details for your QuickBooks host.