首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

Operator not applicable to this operand type异常如何改

2013-10-02 
Operator not applicable to this operand type错误怎么改?with datamodule4.ADOcommand1 dobegincloses:

Operator not applicable to this operand type错误怎么改?
with datamodule4.ADOcommand1 do
                 begin
                    close;
                    s:='insert into orders(orderid,productid,customername.number,orderdate,completedate,shenghe,jiaohuo) ';
                    s:=s+ 'values(edit1.text,copy(combobox1.text,1,pos('-',combobox1.text)),edit2.text,edit3.text,dbdatetimeediteh1.value,dbdatetimeediteh2.value,0,0)';
                    commandtext:=s;
                    execute;
                     showmessage('保存成功!');
                  end;
        end;

[DCC Error] Unit6.pas(145): E2015 Operator not applicable to this operand type
这个是什么原因的错误呀?~
[解决办法]
s:='insert into orders(orderid,productid,customername.number,orderdate,completedate,shenghe,jiaohuo) ';
s:=s+ 'values('''+edit1.text,copy(combobox1.text,1,pos('-',combobox1.text))+''','''+edit2.text+''','''+edit3.text+','''+datetostr(dbdatetimeediteh1.value)+''','''+datetostr(dbdatetimeediteh2.value)+''',0,0)';
[解决办法]
单引号内都会被认定为字符串,比如你的edit1.text 只会显示字符串而不是里面的数据,你可以加断点跟踪下commandtext的值;一楼写法比较正确。

热点排行