问题如下: 当第一次选择combobox1.Text中任何一个如('客户类型')后点击BitBtn1,dbchart可以显示图形。但是再改变选择为combobox1.Text中的('客户来源')后,再点击BitBtn1,就出现例外如下:
raise exception class Edatabaseerror with message 'Qr_Custan:field 'client_souce' not found'在大富翁的离线论坛里搜索,CSDN上找过,只有动态生成Series的解决方法。都没有解决我的问题,望各位不吝赐教!15号要交程序了,急啊!!!!!源程序如下:procedure TFrmClassify.BitBtn1Click(Sender: TObject);
begin
if trim(combobox1.Text)='客户来源' then
with series1,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_source from Custan_source group by client_source');
open;
dmb.Qr_CustAn.Active :=True;
series1.Datasource:=dmb.Qr_CustAn;
series1.Active := False;
series1.Active := True;
XLabelsSource :='client_source';
YValues.ValueSource:='总记录数';
end;
if trim(combobox1.Text)='客户类型' then
with series2,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_type from Custan_Source group by client_type');
open;
dmb.Qr_CustAn.Active :=True;
series2.DataSource:=dmb.Qr_CustAn;
series2.Active := False;
series2.Active := True;
XLabelsSource :='client_type';
YValues.ValueSource:='总记录数';
end;
end;end.
问题如下: 当第一次选择combobox1.Text中任何一个如('客户类型')后点击BitBtn1,dbchart可以显示图形。但是再改变选择为combobox1.Text中的('客户来源')后,再点击BitBtn1,就出现例外如下:
raise exception class Edatabaseerror with message 'Qr_Custan:field 'client_souce' not found'在大富翁的离线论坛里搜索,CSDN上找过,只有动态生成Series的解决方法。都没有解决我的问题,望各位不吝赐教!源程序如下:procedure TFrmClassify.BitBtn1Click(Sender: TObject);
begin
if trim(combobox1.Text)='客户来源' then
with series1,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_source from Custan_source group by client_source');
open;
dmb.Qr_CustAn.Active :=True;
series1.Datasource:=dmb.Qr_CustAn;
series1.Active := False;
series1.Active := True;
XLabelsSource :='client_source';
YValues.ValueSource:='总记录数';
end;
if trim(combobox1.Text)='客户类型' then
with series2,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_type from Custan_Source group by client_type');
open;
dmb.Qr_CustAn.Active :=True;
series2.DataSource:=dmb.Qr_CustAn;
series2.Active := False;
series2.Active := True;
XLabelsSource :='client_type';
YValues.ValueSource:='总记录数';
end;
end;end.
raise exception class Edatabaseerror with message 'Qr_Custan:field 'client_souce' not found'在大富翁的离线论坛里搜索,CSDN上找过,只有动态生成Series的解决方法。都没有解决我的问题,望各位不吝赐教!15号要交程序了,急啊!!!!!源程序如下:procedure TFrmClassify.BitBtn1Click(Sender: TObject);
begin
if trim(combobox1.Text)='客户来源' then
with series1,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_source from Custan_source group by client_source');
open;
dmb.Qr_CustAn.Active :=True;
series1.Datasource:=dmb.Qr_CustAn;
series1.Active := False;
series1.Active := True;
XLabelsSource :='client_source';
YValues.ValueSource:='总记录数';
end;
if trim(combobox1.Text)='客户类型' then
with series2,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_type from Custan_Source group by client_type');
open;
dmb.Qr_CustAn.Active :=True;
series2.DataSource:=dmb.Qr_CustAn;
series2.Active := False;
series2.Active := True;
XLabelsSource :='client_type';
YValues.ValueSource:='总记录数';
end;
end;end.
问题如下: 当第一次选择combobox1.Text中任何一个如('客户类型')后点击BitBtn1,dbchart可以显示图形。但是再改变选择为combobox1.Text中的('客户来源')后,再点击BitBtn1,就出现例外如下:
raise exception class Edatabaseerror with message 'Qr_Custan:field 'client_souce' not found'在大富翁的离线论坛里搜索,CSDN上找过,只有动态生成Series的解决方法。都没有解决我的问题,望各位不吝赐教!源程序如下:procedure TFrmClassify.BitBtn1Click(Sender: TObject);
begin
if trim(combobox1.Text)='客户来源' then
with series1,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_source from Custan_source group by client_source');
open;
dmb.Qr_CustAn.Active :=True;
series1.Datasource:=dmb.Qr_CustAn;
series1.Active := False;
series1.Active := True;
XLabelsSource :='client_source';
YValues.ValueSource:='总记录数';
end;
if trim(combobox1.Text)='客户类型' then
with series2,dmb.Qr_CustAn do
begin
close;
sql.Clear;
sql.Add('select count(company_id) as 总记录数,client_type from Custan_Source group by client_type');
open;
dmb.Qr_CustAn.Active :=True;
series2.DataSource:=dmb.Qr_CustAn;
series2.Active := False;
series2.Active := True;
XLabelsSource :='client_type';
YValues.ValueSource:='总记录数';
end;
end;end.
总体来说, Tdbchat里有2个属性, 一个是统计的字段, 再一个就是统计项目. 比如"性别"和"总数"
后者可以动态修改, 但是前者改不了(我不会). 换句话说可以用饼型图统计出性别比例, 却不能动态改成统计学历比例.
我的解决办法就是通过 select xx AS PUBLIC from .... 把所有的要统计的字段都强行转成一个一样的名字(PUBLIC). 再在设计阶段把tdbchat的相应项目指定为这个共用的名字.
一句话: 不会改的干脆就不该它了, 从sql那里临时改名没问题吧.
感觉tdbchat这点设计的不是很方便, 我翻了半天help也没找到答案, 只能投机取巧了.
帮楼主顶一下, 关注高手给出正解.
是不是度假去了!!
to:zousoft(菜菜鸟的战斗诗歌)
你是说 YValues.ValueSource 吧! 哪个没有问题就是 XLabelsSource 老是出错!
郁闷……