有一张表,叫“合同信息”,里面有一字段“合同编号[char(10]”,我在数据模块里做了个t_coninfo,表名是“合同信息”,然后我想在t_coninfo的newrecord事件里把“合同编号”自动增长1,于是我又做了个q_conid,SQL语句是这样的:select convert(char(4),max(convert(int,substring(合同编号,7,4)))+1) as 最大合同编号 from 合同信息,然后是在t_coninfo的onnewrecord里的代码:
procedure TDataModule2.T_ConInfo1NewRecord(DataSet: TDataSet);
var
id:string;
begin
q_conid.Open;
id:=q_conid.FieldByName('最大合同编号').AsString;
id:=formatdatetime('yyyy',now)+'00'+id;
with t_coninfo do
begin
   open;
   edit;
   FieldByName('合同编号'):=id;
   post;
end;
end.
但是程序却报错,错误提示是:left side cannot be assigned to,怎么回事呢?