Connecting ActiveGanttCSA to a SQL Server DB and other issues
Date:9/16/2011 7:11:15 AM
Product:ActiveGanttCSA Gantt Chart / Scheduler Component
Framework:.Net Framework 4.0 / Visual Studio 2010
User's Development Environment:C# Visual Studio 2010
Subject:How to connect to a SQL Server database

I downloaded the component and want to try it and check whether it suits our requirement. So kindly give the steps for adding the columns and the ways for connect to the Sql DB.



In order to connect to a SQL Server database you can use normal .NET framework objects and commands from the System.Data.SqlClient namespace:





In our demos we use System.Data.OleDb which connects to an Access 2003 database. We do this for ease of installation only, because most Windows operating systems handle Access seamlessly. Setting up a SQL Server, Oracle or DB2 for demo purposes would involve a lot of permission issues.

But System.Data.OleDB and System.Data.SqlClient are practically identical in their interface:

OleDbConnection = SqlConnection

OleDbDataReader = SqlDataReader

ExecuteReader = ExecuteReader

OleDbCommand = SqlCommand

In our demos we encapsulate commands to avoid repeating code, so in the demos we call:

g_DST_ACCESS_ExecuteNonQuery("DELETE FROM some_table WHERE bID = " & SomeID);

Instead of having to create a connection, open it, then create a command, then execute that command and close the connection.

These are commands that are external to ActiveGanttCSA. And the source code is present in the demos:

        public static void g_DST_ACCESS_ExecuteNonQuery(string sSQL)
            using (OleDbConnection oConn = new OleDbConnection(g_DST_ACCESS_GetConnectionString()))
                OleDbCommand oComm = null;
                oComm = new OleDbCommand(sSQL, oConn);

The above applies to all versions of the ActiveGantt component (ActiveGanttVBN, ActiveGanttVC, etc.).

I'm not sure exactly know what you are referring to by "adding the columns". We now have a small tutorial on how to make a simple ASP.NET application with the ActiveGanttCSA component:

Getting Started with the ActiveGanttCSA Gantt Chart Scheduler Component

At the very end it has some code on how to add Columns, Rows and Tasks. Maybe this is what you are looking for.


All trademarks are property of their respective holders, and are only used to directly describe the products and services being provided. Their use in no way indicates any relationship or endorsement between The Source Code Store LLC and the holders of said trademarks.