Q&A

  • DBChart 좀 봐주세요..
콤보박스의 값을 바꾸면 쿼리문이 refresh가 안되네요...
이유를 잘 모르겠어요....꼭 좀 알려주세요........

//전역변수
var
  Form7 : TForm7;
  i     : integer;
  name  : String;
  const item : array[0..9] of String = ('m_type','m_sex','m_office_place','m_duty','m_area','m_rank','m_item','m_food','m_sport','m_music');

//-----------차트보기-----------------------------
procedure TForm7.Button1Click(Sender: TObject);
begin
    if Query1.Active <> True  then begin
       Query1.Active := True;
       if Query1.FieldValues['type'] > 0 then begin
          Series1.DataSource := Query1;
          Series1.XLabelsSource := name;
          Series1.PieValues.ValueSource := 'type';
       end
       else
          showmessage('자료가 없습니다.');
    end;
end;

//----콤보박스값이 바뀔때---------------------
procedure TForm7.ComboBox1Change(Sender: TObject);
begin
  Query1.Active := False;
  for i:= 0 to 9 do
     if ComboBox1.ItemIndex = i then
        name := item[i]  ;

  if ComboBox1.ItemIndex = -1 then
    showmessage('데이터를 선택하세요')
  else begin
    Query1.SQL.Clear;
    Query1.SQL.Add('select count('+ name +') as type,' + name + ' from member group by '+ name);

  end;
end;
0  COMMENTS