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的值;一楼写法比较正确。