Solved

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

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Introduction This article is a continuation of the C/C++ Visual Studio Express debugger series. Part 1 provided a quick start guide in using the debugger. Part 2 focused on additional topics in breakpoints. As your assignments become a little more …
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

760 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

18 Experts available now in Live!

Get 1:1 Help Now