回 帖 发 新 帖 刷新版面

主题:帮我看看 这段代码  错在那

if ComboBox1.Txet=('一月') then
 begin
  ADOTable2.First;
  adoquery1.SQL.Add('select 业绩量 from 工作表 where state  like'+'''%'+ComboBox1.Text='一月'+'%''' );
  adoquery1.SQL.Add('select 业绩量 from 工作表 where state  like'+'''%'+ComboBox1.Text='十一月'+'%''' );
  adoquery1.SQL.Add('select 业绩量 from 工作表 where state  like'+'''%'+ComboBox1.Text='十二月'+'%''' );
  sum1:=sum1+ADOTable2.fieldbyname('业绩量').value;
  ADOTable2.next;
  end;

回复列表 (共12个回复)

沙发

不能同时写三个查询语句的

板凳


如何改啊  请教啊  谢谢

3 楼


adoquery1.close;
adoquery1.sql.clear;
adoquery1.sql.add('select * ......');
adoquery1.open;

4 楼

调试是 if ComboBox1.Txet=('一月') then  有错啊

5 楼

什么错误?
if combobox1.text = '一月' then
...

这么写应该没错了.

6 楼

也错啊  你帮我看看 这断代码 
if ComboBox1.Text:='一月' then //选择查询条件
 begin
  while not ADOTable2.Eof do
    adoquery1.close;
    ADOQuery1.SQL.Clear;
  ADOTable2.First;
  adoquery1.SQL.Add('select 业绩量 from 工作表 where state  like'+'''%'+ComboBox1.Text='一月'+'%''' );
  adoquery1.SQL.Add('and where state  like'+'''%'+ComboBox1.Text='十一月'+'%''' );
  adoquery1.SQL.Add('and where state  like'+'''%'+ComboBox1.Text='十二月'+'%''' );
  adoquery1.open;
  sum1:=sum1+ADOTable2.fieldbyname('业绩量').value;

7 楼


   提示这样的错误啊 [Error] Type of expression must be BOOLEAN

8 楼

ComboBox1.Txet=('一月')

ComboBox1.Text:='一月

到底哪个是你写的?
看清楚 ':=' 和 '='!!
一个赋值,一个比较

[Error] Type of expression must be BOOLEAN
这个错误是说,表达式的类型必须是Bool型的.

9 楼

adoquery1.SQL.Add('select 业绩量 from 工作表 where state  like'+'''%'+ComboBox1.Text:='一月'+'%''' );
这有错 帮我看看  错在那  错误提示为[Error] Incompatible types: 'String' and 'procedure, untyped pointer or untyped parameter'

10 楼

ComboBox1.Text:=
去了

我来回复

您尚未登录,请登录后再回复。点此登录或注册