Product Documentation

FairCom ADO.NET Driver - Developer's Guide

Previous Topic

Next Topic

Tutorial 1: Data Basics - Create, Insert, Update, Delete, Find, Retrieve


This tutorial will take you through the basic use of the FairCom DB ADO.NET Data Provider using C#.

As with all other examples in the c-tree tutorial series, this tutorial simplifies the creation and use of a database into four simple steps: Initialize(), Define(), Manage(), and You’re Done() !

Tutorial #1: Introductory - Simple Single Table

We wanted to keep this program as simple as possible. This program does the following:

  • Initialize() - Connects to the FairCom Database Engine.
  • Define() - Defines and creates a "customer master" (custmast) table/file.
  • Manage() - Adds a few rows/records; Reads the rows/records back from the database; displays the column/field content; and then deletes the rows/records.
  • Done() - Disconnects from FairCom Database Engine.

The best way to follow along is to use your debugger. Open the tutorial solution with Microsoft Visual Studio, and single-step through the code. If you have not already done so, launch Visual Studio, and open the solution that corresponds to the version of Visual Studio you have. The solution files (all called CSharpTutorials.sln) can be found in the following directory within the FairCom installation directories:

drivers\\tutorials\IDEProjects\Microsoft Visual Studio 2012

drivers\\tutorials\IDEProjects\Microsoft Visual Studio 2010

drivers\\tutorials\IDEProjects\Microsoft Visual Studio 2019

From within the Microsoft Visual Studio IDE, open the Solutions Explorer to see the four tutorial projects. Be sure to set CSharpTutorials1 as the active project by right-clicking on it and selecting Set as StartUp Project as shown here:

ADO.NET Console Tutorial StartUp Project

Now press F11 to activate debugging and single step into the program. The program will be automatically built if necessary.

Note our simple Main() function:

using System;

using Ctree.Data.SqlClient;

namespace CSharpTutorial


class Tutorial1


// declare connection, command and reader objects

static CtreeSqlConnection conn;

static CtreeSqlCommand cmd;

static CtreeSqlDataReader rdr;


// main()


// The main() function implements the concept of "init, define, manage

// and you're done..."


static void Main()






Console.Write("\nPress <ENTER> key to exit . . .");



We suggest opening the source code with your own editor.

Continue now to review these four steps.

In This Section





Additional Resources