Product Documentation

FairCom ADO.NET Driver

Previous Topic

Next Topic

Init

First we need to open a connection to a database by providing the FairCom Database Engine with a user name, password and the database name.

Below is the code for Initialize():

//

// Initialize()

//

// Perform the minimum requirement of logging onto the c-tree Server

//

static void Initialize()

{

Console.WriteLine("INIT");

try

{

// initialize connection object

conn = new CtreeSqlConnection();

conn.ConnectionString = "UID=ADMIN;PWD=ADMIN;Database=CtreeSql;Server=localhost;Service=6597;";

// initialize command object

cmd = new CtreeSqlCommand();

cmd.CommandType = System.Data.CommandType.Text;

cmd.Connection = conn;

cmd.Transaction = null;

// connect to server

Console.WriteLine("\tLogon to server...");

conn.Open();

}

catch (CtreeSqlException e)

{

Handle_Exception(e);

}

catch (Exception e)

{

Handle_Exception(e);

}

}

TOCIndex