QuickBooks Online is one of the leading cloud-based accounting solutions that allows businesses to manage finances, track income and expenses, send invoices, and generate detailed financial reports, all in one place.
In this article, you'll learn how to securely connect to QuickBooks Online from a C# application using a specialized ADO.NET data provider dotConnect for QuickBooks Online for simplicity and reliability. We'll walk through the essentials and show how to integrate your application with this powerful platform and start working with financial data.
Why dotConnect for QuickBooks Online?
Easy integration with QuickBooks Online
dotConnect makes it easy for .NET applications to connect to QuickBooks Online and access accounting data like customers, invoices, and payments without dealing with API complexity.
Interactive OAuth token generation
dotConnect supports authentication via Interactive OAuth with a browser-based login flow for users. After authorization, it automatically obtains and manages access and refresh tokens.
User-friendly ADO.NET classes
The data provider uses standard ADO.NET data access classes, letting developers interact with QuickBooks Online data using familiar connection, command, and data reader patterns.
Advanced ORM Support
dotConnect supports popular .NET ORM technologies, including EF Core, Dapper, NHibernate, and LinqConnect, for QuickBooks Online data modeling.
Full ADO.NET Compliance
Established ADO.NET interfaces and conventions ensure reliable integration with existing .NET applications and development workflows.
Support & frequent updates
Dedicated technical support, comprehensive documentation, and regular updates ensure compatibility with QuickBooks Online services and .NET platforms.
Download and activate dotConnect for QuickBooks Online
You can start using dotConnect for QuickBooks Online immediately with a 30-day free trial. Choose one of the following installation options:
dotConnect for QuickBooks Online uses an interactive OAuth authorization flow to obtain access tokens and establish a connection with the data source. This approach enables secure data access without requiring the application to handle user credentials.
When a connection is opened for the first time, the provider launches a browser window, prompting the user to complete the authorization process. Once authorization is granted, the access tokens are securely stored, and subsequent connections can be established without additional user interaction. You only need to provide a valid license key.
This interactive authentication flow improves security while giving users full control over access permissions.
Here is the sample code that will help you connect to QuickBooks Online. Complete it with the following credentials: Client Id, Company Id, Client Secret, Refresh token, and License key. Additionally, set Sandbox to true if you are using the sandbox application type.
using System.Data;
using Devart.Data.QuickBooks;
classProgram
{
staticvoidMain()
{
using QuickBooksConnection conn = new(
"Authentication Type=OAuthInteractive;" +
"License Key=**********");
conn.Open();
using QuickBooksCommand cmd = new(
"SELECT Id, Name, FullyQualifiedName, Description FROM Account", conn);
using QuickBooksDataReader reader = cmd.ExecuteReader();
if (!reader.HasRows)
{
Console.WriteLine("No data found in the Account table.");
return;
}
while (reader.Read())
{
string id = reader["Id"]?.ToString() ?? "N/A";
string name = reader["Name"]?.ToString() ?? "N/A";
string fqn = reader["FullyQualifiedName"]?.ToString() ?? "N/A";
string description = reader["Description"]?.ToString() ?? "N/A";
Console.WriteLine($"Id: {id}");
Console.WriteLine($"Name: {name}");
Console.WriteLine($"FullyQualifiedName: {fqn}");
Console.WriteLine($"Description: {description}");
Console.WriteLine(newstring('-', 50));
}
}
}
Once you successfully connect your application to QuickBooks Online, you will be able to fetch and manage your data.
Connection string examples
In .NET applications, a connection string is a formatted string that provides the information required to establish a connection to a data source.
At its core, the connection string tells the provider where to connect, how to authenticate, and what settings to use during the connection process. Once supplied, the data provider parses the string, validates its syntax, and ensures that all specified keywords are supported. After this initial validation, the extracted parameters are passed to the data source, which performs additional checks and ultimately establishes the connection.
The table below outlines some of the most commonly used connection string parameters.
Name
Description
Authentication Type
The authentication method: Refresh Token, Access Token, or OAuthInteractive
Company Id
The string that uniquely identifies a QuickBooks company
Access Token
QuickBooks OAuth 2.0 access token
Client Id
The first part of the OAuth 2.0 credentials pair that is obtained when you register a client application at developer.intuit.com/myapps with the developer account
Client Secret
The second part of the OAuth 2.0 credentials pair that is obtained when you register a client application at developer.intuit.com/myapps with the developer account
License Key
Specifies the license key
For a complete list of parameters and detailed descriptions, refer to the official guidelines.
Conclusion
You can now connect your C# application to QuickBooks Online using dotConnect for QuickBooks. With the connection in place, you can extend your application to perform a wide range of operations, such as querying customers, invoices, and accounts, as well as creating, updating, and managing QuickBooks data programmatically.
And if you want firsthand experience, feel free to download dotConnect for QuickBooks Online for a free 30-day trial. Give it a go under the real workload!
FAQ
How do you install and activate dotConnect for QuickBooks Online in a .NET project?
Install dotConnect for QuickBooks Online using the EXE installer or by adding the Devart.Data.QuickBooks NuGet package to your project. Then obtain your Activation Key from your Devart Customer Portal and include it in the connection string via the License Key parameter.
How do you authenticate to QuickBooks Online using Interactive OAuth in dotConnect?
To authenticate with QuickBooks Online, set the connection string parameter: Authentication Type=OAuthInteractive. When QuickBooksConnection opens, a browser window launches for you to sign in to your Intuit account and grant access. After authorization, dotConnect automatically retrieves and stores the access and refresh tokens.
How do you create a connection to QuickBooks Online using dotConnect in C#?
Define a connection string that includes the CompanyID, authentication parameters, and the License Key. Then create a QuickBooksConnection instance with this string and call Open() inside a TRY-CATCH block to establish the connection and handle possible errors.
Can you query QuickBooks Online data using SQL with dotConnect?
Yes, dotConnect allows you to work with QuickBooks Online data using SQL queries. Developers can retrieve and manipulate objects such as Customers, Invoices, and Payments through familiar SQL commands.
Can you connect to QuickBooks Online using Entity Framework Core and dotConnect?
Yes, you can use Entity Developer to visually generate an EF Core model from QuickBooks Online entities, or run Scaffold-DbContext with the Devart.Data.QuickBooks.EFCore package and a dotConnect connection string (including the License Key) to create the DbContext and entity classes.
Is it possible to access QuickBooks Online data in Visual Studio Server Explorer with dotConnect?
Yes, open Server Explorer in Visual Studio add a new Data Connection, choose dotConnect for QuickBooks Online as the provider, configure authentication and company details, test the connection, and explore QuickBooks Online objects directly in the IDE.
I'm a technical content writer who loves breaking complex tech topics into clear and helpful content that's enjoyable to read. With a solid writing background and growing skill in software
development and database tools, I create content that's accurate, easy to follow, and genuinely useful. When I'm not writing, you'll probably find me learning something new or sweating it out at the gym.