Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8783627
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:52:03+00:00 2026-06-13T20:52:03+00:00

I have used following code to create Dynamically series of TDBChart. I used MS-Access

  • 0

I have used following code to create Dynamically series of TDBChart. I used MS-Access and TADOQuery component. CODE on BUTTON Click Event.

var
qryData: TADOQuery;
intCnt: integer;
strlstField: TStringList;

begin
strlstField := TStringList.Create();
qryData := TADOQuery.Create(nil);
qryData.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0; Data Source=' + ExtractFilePath(Application.ExeName) + 'data.mdb';
qryData.SQL.Add('SELECT dept_name,2005 as [2005],2006 as [2006],2007 as [2007],'+
               '2008 as [2008],2009 as [2009],2010 as [2010], 2011 as [2211] FROM SALES');
qryData.Active := True;

DBChart1.Title.Text.Clear;
DBChart1.Title.Text.Add('Department Wise Sales Report');
DBChart1.Title.Font.Size := 14;
DBChart1.LeftAxis.Title.Font.Size := 12;   
DBChart1.LeftAxis.Title.Caption := 'Sales in Rs.';
DBChart1.BottomAxis.Title.Font.Size := 12;
DBChart1.BottomAxis.Title.Caption := 'Department Name';

//Charting Series
   //To Remove Old Series
for intCnt := DBChart1.SeriesCount -1 downto 0 do
   DBChart1.Series[intCnt].Free;
   //To Add New Series
for intCnt := 1 to qryData.FieldCount - 1 do begin
   strlstField.Add(qryData.FieldList[intCnt].FieldName);
   DBChart1.AddSeries(TBarSeries.Create(nil));
end;
   //To set source for Series
for intCnt:= 0 to DBChart1.SeriesCount -1 do begin
   with  DBChart1 do begin
      Series[intCnt].Clear;
      Series[intCnt].Title := strlstField[intCnt];
      Series[intCnt].ParentChart := DBChart1;
      Series[intCnt].DataSource := qryData;
      Series[intCnt].XLabelsSource := 'dept_name';
      Series[intCnt].YValues.ValueSource := strlstField[intCnt];
   end;
end;

PROBLEM: When i change data in DATABASE and Re-run the application chart remain same. No reflection done in chart series. Had any mistake in Above Code?
enter image description here

Another Problem is that in the picture, series are at 2000 value, but i have add all value above 20,000 in the DATABASE.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T20:52:05+00:00Added an answer on June 13, 2026 at 8:52 pm

    The SELECT statement is passing integers, not field names, which is why they are all around 2,000 – because that is the value of the year as an integer.

    Are your fields actually called 2005 etc? If so, you need to bracket the field names so they are treated like field names and not like integers:

    qryData.SQL.Add('SELECT dept_name, [2005] as [2005], [2006] as [2006], [2007] as [2007], ' +
        '[2008] as [2008], [2009] as [2009], [2010] as [2010], [2011] as [2011] FROM SALES');
    

    Note also that you are aliasing 2011 incorrectly as 2211 (fixed in mine above).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have used following code to create a simple PDF file. It executes fine
i have used the following xml code to create the layout. <?xml version=1.0 encoding=utf-8?>
I have used the following code to create two threads: //header files #include <pthread.h>
I have used the following code to create the XML Document : procedure TForm1.btnCreateXMLClick(Sender:
I have used the following code to create a new thread: [NSThread detachNewThreadSelector:@selector(backgroundMethod:) toTarget:self
I have used the following code to create a file in a temp location
i have to change image color dynamically using php i used the following code
I have used the following code in my models.py file: Create hyperlink to foreignkey
I have Web-App. Somewhere in my page I used following code to create a
I have used following code to convert string to json and parse it. String

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.