Jump to content
Software FX Community

Re: Help create gantt chart from SQL and ADO?


Software FX

Recommended Posts

As a code sample where the data is took from an table called "tbltest"

contained in a Microsoft Access Data Base called "test.mdb" the code would

be this:

Dim Conn As New ADODB.Connection

Dim RS As ADODB.Recordset

Dim CfxData As New CfxDataAdo

' Read from sample database

Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist

Security Info=False;Data Source=" & App.Path & "\test.mdb"

Conn.Open

Set RS = Conn.Execute("SELECT * FROM tbltest")

ChartFX1.Series(1).YAxis = AXIS_Y2

' Send data to chart

ChartFX1.DataType(1) = CDT_LABEL

ChartFX1.DataType(2) = CDT_LABEL

ChartFX1.DataType(3) = CDT_LABEL

CfxData.ResultSet = RS

ChartFX1.GetExternalData CfxData

' Init chart style

ChartFX1.Gallery = BAR

ChartFX1.MultipleColors = False

' Release

RS.Close

Conn.Close

--

Regards,

Percy Dyer

Software FX, Inc. Tech Support

Please reply to: Cfx98@softwarefx.com

================================================

"Dan Hickman" <dhickman@mediaone.net> wrote in message

news:bMJS5D2TAHA.1424@sfxserver.softwarefx.com...

> hello everyone :-),

> I have a database that contains Start and Finish Dates for a list of

tasks.

> I would like to bind the ChartFx to a recordset like the following:

>

> Public Sub TaskCapDelayed()

> 'Create variables for ADO Connection and Resultset

> Dim RS As ADODB.Recordset

>

> 'Create variable to hold the Chart FX Default Data provider

> Dim CfxData As Object

>

> 'Open the connection

> Set RS = DataEnvironment1.Connection1.Execute("Select BaselineStart,

> BaselineFinish FROM tblTasks")

>

> 'Create Ado object from the Chart FX Resultset

> Set CfxData = CreateObject("CfxData.Ado")

>

> 'Assign the ADO resultset to the ChartFX Data Provider

> CfxData.ResultSet = RS

>

> With frmMain.cCriticalTasks

> ' Chart Type Settings

> .Gallery = GANTT

> 'Let Chart FX take information from the data provider

> .GetExternalData CfxData

> 'Add any other adjustments to the object here.

> '

> '

> End With

> ProcExit:

>

> RS.Close

>

> Set RS = Nothing

> Set CfxData = Nothing

> End Sub

>

>

> When I execute this sub, ChartFX says "No data Available". Can anyone

help

> me on this one? Any directions would be wonderful.

>

> Thanks in advance,

> Daniel Hickman

>

>

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...