Solved

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

Posted on 2000-03-27
5
392 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Unlike C#, C++ doesn't have native support for sealing classes (so they cannot be sub-classed). At the cost of a virtual base class pointer it is possible to implement a pseudo sealing mechanism The trick is to virtually inherit from a base class…
This article shows you how to optimize memory allocations in C++ using placement new. Applicable especially to usecases dealing with creation of large number of objects. A brief on problem: Lets take example problem for simplicity: - I have a G…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

932 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now