自己定义了一个button click 事件,代码和报错信息如下,请帮忙看看,谢谢。
unit prjgrid;
interface
uses
Business.System, Business.Model, Business.Forms, Business.Data;
type
Tprjgrid = class(TSheetDoc)
Button1: TButton;
InfoBroker1: TInfoBroker;
DataSetBroker1: TDataSetBroker;
DataSetBroker2: TDataSetBroker;
procedure Button1Click(Sender: TObject);
private
{private declarations}
public
{public declarations}
end;
implementation
procedure Tprjgrid.Button1Click(Sender: TObject);
begin
var
sFilter:string;
//[错误]Biz:\GCHTGL\GCXM\PRJINFO.INFO.DIR\prjgrid.SheetDoc.pas(25, 1): line 25: unexpected token: var
begin
sFilter:='';
if Length(DataSet2.FieldByname('prjid').AsString)>0 then
sFilter:=sFilter + 'AND (prjid LIKE ''%'+DataSet2.FieldByName('pijid').AsString+'%'')';
if Length(DataSet2.FieldByName('prjkind').AsString)>0 then
sFilter:=sFilter + 'AND (prjkind = '''+DataSet2.FieldByName('prjkind').AsString+''')';
if Length(DataSet2.FieldByName('year').AsString)>0 then
sFilter:=sFilter + 'AND (to_char(year,'yyyy') = '''+DataSet2.FieldByName('year').AsString+''')';
//[错误]Biz:\GCHTGL\GCXM\PRJINFO.INFO.DIR\prjgrid.SheetDoc.pas(34, 45): line 34: unexpected token: yyyy
//[错误]Biz:\GCHTGL\GCXM\PRJINFO.INFO.DIR\prjgrid.SheetDoc.pas(34, 49): line 34: expecting "end", found ') = ''
//[错误]Biz:\GCHTGL\GCXM\PRJINFO.INFO.DIR\prjgrid.SheetDoc.pas(34, 57): line 34: expecting "end", found '+'
//[错误]Biz:\GCHTGL\GCXM\PRJINFO.INFO.DIR\prjgrid.SheetDoc.pas(34, 58): line 34: expecting ';', found 'DataSet2'
//[错误]Biz:\GCHTGL\GCXM\PRJINFO.INFO.DIR\prjgrid.SheetDoc.pas(34, 66): line 34: expecting "end", found '.'
if Length(DataSet2.FieldByName('deptid').AsString)>0 then
sFilter:=sFilter + 'AND (deptid = '''+DataSet2.FieldByName('deptid').AsString+''')';
DataSetBZSJJ1.UserFilter:=stringutils.Copy(sFilter,5,10000);
end;
end;
end. |