set the #d1 to ... is OK.
Query1.DisableControls;
ReportRunTime1.ReportFile:=rpt1;
With ReportRunTime1do
begin
EnableEdit:=True;
SetDataSet('d1',Query1);
//设置报表模板中的数据集变量名
SetVarValue('shuoming','代码说明');
//设置报表模板中的字符变量内容
SetVarValue('code',Code1);
PrintPreview(True);
//打印
end;
Query1.EnableControls;