Getting Started With dotConnect for Zoho Books

Below are some resources to help you maximize your experience with dotConnect for Zoho Books.

dotConnect for Zoho Books is a high-performance ADO.NET data provider with ORM support. It offers fast and safe access to Zoho Books data for application development.

  • EF Core, Dapper, NHibernate ORM support
  • Local SQL engine with support for SQL-92
  • Compatibility with various .NET platforms and versions
  • Full compliance with ADO.NET
  • Integration with Visual Studio

Code examples

using Devart.Data.ZohoBooks;

namespace ZohoBooksConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "" +
    "Authentication Type=OAuth2Interactive;" +
    "DataCenter=US;" +
    "License key=**********";

            try
            {
                using (ZohoBooksConnection connection = new ZohoBooksConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }

    }
}
PM> Install-Package Devart.Data.ZohoBooks
using Devart.Data.ZohoBooks;

namespace ZohoBooksConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string domain = "YOUR_DOMAIN";
            string clientId = "YOUR_CLIENT_ID";
            string clientSecret = "YOUR_CLIENT_SECRET";

            string connectionString = "Authentication Type=OAuth2Interactive;DataCenter=US;" +
                                      $"Domain={domain};" +
                                      $"Client Id={clientId};" +
                                      $"Client Secret={clientSecret};" +
                                      "License key=**********";

            try
            {
                using (ZohoBooksConnection connection = new ZohoBooksConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.ZohoBooks
using System;
using System.Data;
using Devart.Data.ZohoBooks;

namespace ZohoBooksConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuth2Interactive;DataCenter=US;License key=**********";

            try
            {
                using (ZohoBooksConnection connection = new ZohoBooksConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");

                    string sql = "SELECT ContactName, Phone, Website, CompanyName FROM Contacts";

                    using (ZohoBooksCommand command = new ZohoBooksCommand(sql, connection))
                    using (ZohoBooksDataAdapter adapter = new ZohoBooksDataAdapter(command))
                    {
                        DataTable accountsTable = new DataTable();
                        adapter.Fill(accountsTable);

                        foreach (DataRow row in accountsTable.Rows)
                        {
                            string contactName = row.Field("ContactName") ?? string.Empty;
                            string phone = row.Field("Phone") ?? string.Empty;
                            string website = row.Field("Website") ?? string.Empty;
                            string companyName = row.Field("CompanyName") ?? string.Empty;

                            Console.WriteLine($"Name: {contactName} | Phone: {phone} | Website: {website} | Company: {companyName}");
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.ZohoBooks
using System;
using System.Linq;

namespace ZohoBooksEFCore
{
    class Program
    {
        static void DisplayAccounts()
        {
            using (var context = new ZohoModel())
            {
                var accounts = context.contacts
                    .Select(a => new { a.contactName, a.Phone, a.Website, a.CompanyName })
                    .ToList();

                foreach (var contact in contacts)
                {
                    Console.WriteLine($"Name: {contact.contactName}");
                    Console.WriteLine($"Phone: {contact.Phone}");
                    Console.WriteLine($"Website: {contact.Website}");
                    Console.WriteLine($"Company: {contact.CompanyName}");
                    Console.WriteLine(new string('-', 20));
                }
            }
        }
    }
}
PM> Install-Package Devart.Data.ZohoBooks.EFCore
using System;
using System.Data;
using Devart.Data.ZohoBooks;

namespace ZohoBooksConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuth2Interactive;DataCenter=US;License key=**********";

            try
            {
                using (ZohoBooksConnection connection = new ZohoBooksConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");

                    // Insert a new Contact using a parameterized ZohoBooksCommand (skipping Phone - read-only)
                    Console.WriteLine("\nInserting a sample Contact via ZohoBooksCommand...");
                    string insertSql = @"INSERT INTO Contacts
                        (ContactName, Website, CompanyName)
                        VALUES (@ContactName, @Website, @CompanyName)";

                    using (ZohoBooksCommand insertCmd = new ZohoBooksCommand(insertSql, connection))
                    {
                        // Devart ZohoBooks provider matches parameter names without the '@' prefix.
                        insertCmd.Parameters.AddWithValue("ContactName", "Example Contact via Command");
                        insertCmd.Parameters.AddWithValue("Website", "https://example.com");
                        insertCmd.Parameters.AddWithValue("CompanyName", "True Company Inc.");

                        int affected = insertCmd.ExecuteNonQuery();
                        Console.WriteLine($"Insert complete. Rows affected: {affected}\n");
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM > Install-Package Devart.Data.ZohoBooks
using System;
using System.Data;
using Devart.Data.ZohoBooks;

namespace ZohoBooksConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuth2Interactive;DataCenter=US;License key=**********";

            try
            {
                using (ZohoBooksConnection connection = new ZohoBooksConnection(connectionString))
                {
                    connection.Open();
                    Console.WriteLine("Connection successful.");

                    // Example: UPDATE with parameters
                    ZohoBooksCommand cmd = connection.CreateCommand();
                    cmd.CommandText = "UPDATE Contacts SET Website = :website WHERE ContactName = :name";
                    cmd.Parameters.Add("website", DbType.String).Value = "www.devart.com";
                    cmd.Parameters.Add("name", DbType.String).Value = "Emma Thomas";

                    int affected = cmd.ExecuteNonQuery();
                    Console.WriteLine($"Updated {affected} row(s).");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occurred: " + ex.Message);
            }
        }
    }
}
PM> Install-Package Devart.Data.ZohoBooks
using System;
using System.Data;
using Devart.Data.ZohoBooks;

namespace ZohoBooksConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        {
            string connectionString = "Authentication Type=OAuth2Interactive;DataCenter=US;License key=**********";

            try
            {
                ExecuteUpdate(connectionString);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An unexpected error occurred: " + ex.Message);
                Console.WriteLine(ex.ToString());
            }
        }

        static void ExecuteUpdate(string connectionString)
        {
            using (var myConnection = new ZohoBooksConnection(connectionString))
            using (var myCommand = new ZohoBooksCommand(
                "UPDATE Contacts SET Website = 'www.devart.com' WHERE ContactName = 'Emma Thomas'", myConnection))
            {
                try
                {
                    myConnection.Open();
                    Console.WriteLine("Connection opened. Executing update...");

                    int rowsAffected = myCommand.ExecuteNonQuery();
                    Console.WriteLine("Operation complete. Rows Affected: " + rowsAffected);
                }
                catch (Exception ex)
                {
                    Console.WriteLine("Error during execution: " + ex.Message);
                    Console.WriteLine(ex.ToString());
                }
                finally
                {
                    if (myConnection.State != ConnectionState.Closed)
                        myConnection.Close();
                }
            }
        }
    }
}
PM> Install-Package Devart.Data.ZohoBooks

Documentation

Licensing
Licensing
A detailed technical reference on embedding license information – a required resource for applications built with dotConnect for Zoho Books.
DataAdapter Features
DataAdapter features
A comprehensive guideline on using the ZohoDataAdapter class for interacting with Zoho Books data in a disconnected architecture.
Parameters
Parameters
An overview of SQL query parameters and their synchronization, along with practical insights into working with stored procedures.
SQL translation
SQL translation
Since remote execution is significantly faster than client-side processing, using translatable SQL ensures optimal query performance.

dotConnect Universal

Get universal access to data from a variety of sources, including SQL Server, Oracle, PostgreSQL, MySQL, SQLite, DB2, InterBase, Microsoft Access, and Firebird. Other servers can be accessed through their ADO.NET, OLE DB and ODBC providers.

FAQ

What is the trial period for dotConnect for Zoho Books?
dotConnect for Zoho Books offers a fully functional 30-day trial. During this period, you can use and evaluate all features without limitations. After the trial ends, you can purchase a license to keep using the product.
Why do I need to install the product if NuGet is available?

dotConnect for Zoho Books provides two sets of assemblies, and the choice depends on your project type:

  • For .NET Framework projects: Use the Devart assemblies included with the product installer.
  • For .NET (.NET Core/.NET 5+) projects: Use the assemblies available via NuGet packages.
Where should I apply my License Key?

The method for applying your license depends on your project type:

  • For .NET (.NET Core/.NET 5+) projects, apply the License Key at runtime using the License Key connection string parameter.
  • For .NET Framework projects, no license key is necessary. Download and install the licensed version of dotConnect from your Devart Customer Portal.
Do the end-users of my application need a Devart license, or do I have to pay additional fees for deploying my software?

No, end users do not need a Devart license, and there are no additional deployment fees, as long as you hold a valid Devart license.

According to the EULA, you're allowed to redistribute the following runtime assemblies with your application:

  • Devart.Data.ZohoBooks.dll
  • Devart.Data.dll

You can include them in your app's folder (such as Bin for web apps) or register them in the GAC. Just make sure to use them in your solution only.

There's no need for a full installation on the target machine, you can also use the "Minimal installation" option provided by the setup. It does not disturb any other dotConnect components.

How can I update dotConnect to a new version?

To update dotConnect to a new version, you need to reinstall it:

  • 1. Open Settings > Apps > Installed apps in Windows.
  • 2. Uninstall the current and any older versions of dotConnect, including Entity Developer and LinqConnect, if installed.
  • 3. Visit the Customer Portal and download the latest licensed version.
  • 4. Install the downloaded version and receive the latest features and improvements.
How can I completely remove all previous versions of a product?

1. Go to Settings > Apps > Installed apps and uninstall:

  • All dotConnect providers
  • Entity Developer
  • LinqConnect

2. Manually delete any leftover files from the following locations (if they exist):

GAC folders:

  • C:\Windows\assembly\GAC_MSIL
  • C:\Windows\Microsoft.NET\assembly\GAC_MSIL

Program files and extensions:

  • C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\IDE\Extensions\Devart
  • C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\IDE\Extensions\Devart
  • C:\Program Files (x86)\Devart
  • C:\Program Files\Devart
  • C:\Program Files (x86)\Common Files\Devart
  • C:\Program Files\Common Files\Devart

Program data folders:

  • C:\ProgramData\Devart\dotConnect
  • C:\ProgramData\Devart\Entity Developer

Removing these ensures a clean system and prevents conflicts during future installations.

Wield the full firepower of dotConnect for Zoho Books
Go with the advanced edition of dotConnect for Zoho Books and stay at the top of your game from day one!