Solved

i use the c++ builder and got some error!

Posted on 2000-03-27
5
395 Views
Last Modified: 2012-05-04
__fastcall TForm1::TForm1(TComponent* Owner)
        : TForm(Owner)
{
  while(!Query1->Eof)
  {

      // get data from first table
      // and save data into csc
      String csc = Query1->FindField("STKCODE")->AsString;
     // String sss = csc;
     // Edit2->Text = csc;

      // into csc to second table and get data
      // String sss;
      Query2->Close();
      Query2->SQL->Clear();
      Query2->SQL->Add("select syear*100+smon,sb_vol,lb_vol,cp");
      Query2->SQL->Add("from ap.amgin");
      Query2->SQL->Add("where STKCODE = :sss");
      Query2->SQL->Add("and syear*100+smon >199702");
      Query2->Active=TRUE;
      Query2->ParamByName("sss")->AsString= csc;
      Query2->ExecSQL();
      Query2->Open();
      // use the data of second table to draw the line chart
      Series1->DataSource=Query2;
      Series1->ParentChart=DBChart1;
      XLabelsSource='syear*100+smon';
      YValues.ValueSource:= 'sb_vol';
      Series2->DataSource=Query2;
      Series2->ParentChart=DBChart1;
      XLabelsSource='syear*100+smon';
      YValues.ValueSource:= 'lb_vol';
      Series3->DataSource=Query2;
      Series3->ParentChart=DBChart1;
      XLabelsSource='syear*100+smon';
      YValues.ValueSource:= 'cp';
      DBChart1->SaveToBitmapFile("c:\\gmgin+csc+.bmp");
      Query1->Next();

  }


the code seems have some logic error.
but i couldn't debug.
i hope some one can help me.
thank you very much  
0
Comment
Question by:erichuang
  • 2
  • 2
5 Comments
 
LVL 22

Expert Comment

by:nietod
ID: 2660415
Why do you say it has an error?  what are the symptoms?
0
 

Author Comment

by:erichuang
ID: 2660667
the program has no error.
but i think maybe my logic is wrong
..so i need some body can suggest to me.
especially :
DBChart1->SaveToBitmapFile("c:\\gmgin+csc+.bmp");
the csc is a global value.
but i just can save to gmgin+csc+.bmp
not gmgin1101.bmp;gmgin1102.bmp.....
thank you very much!
0
 
LVL 14

Accepted Solution

by:
AlexVirochovsky earned 150 total points
ID: 2661131
>>DBChart1->SaveToBitmapFile("c:\\gmgin+csc+.bmp");
Of course, it is error.
Right code:

char szName[255];
wsprintf(szName, "C:\\gmgin%d.bmp" ,csc);
DBChart1->SaveToBitmapFile(szName);
I hope, it helps. Alex
0
 

Author Comment

by:erichuang
ID: 2667532
i am glad to meet you!and thanks a lot
you give me much help.i hope next you can help me like this time!

                 eric
0
 
LVL 14

Expert Comment

by:AlexVirochovsky
ID: 2667814
Hi, eric. I am very glad to help you.
Don't forget evaluate my reply(accept
with some grade).
Alex
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question