// *******************************************//
// function : 保存报表文件到数据库中
// Author : Wangdawei
// Modify Date :2002-01-24
// *******************************************//
function TfrmXtQuery.SaveRptToDatabase(const FileName,
SqlCode: string): Boolean;
begin
Result:=true;
with TQuery.Create(Self)do
try
try
DatabaseName:=SysDatabase.DbMis.DatabaseName;
SQL.Add('Update tXtDefScript');
SQL.Add(' Set RptDesign=
Content');
SQL.Add(' Where SqlCode=
SqlCode');
ParamByName('pSqlCode').AsString:=SqlCode;
ParamByName('pContent').LoadFromFile(FileName,ftBlob);
ExecSql;
except
on E:Exceptiondo
begin
UWriteErrLog('Xt',Self.Caption,E.Message);
UErrorMsgBox('查询报表设计文件出错,请查看出错日志!');
Result:=false;
end;
end;
finally
Free;
end;
end;
// *******************************************//
// function : 导出报表文件
// Author : Wangdawei
// Modify Date :2002-01-24
// *******************************************//
function TfrmXtQuery.GetRptToFile(Const FileName,SqlCode: string): Boolean;
begin
Result:=true;
with TQuery.Create(Self)do
try
try
DatabaseName:=SysDatabase.DbMis.DatabaseName;
SQL.Add('Select RptDesign');
SQL.Add('From tXtDefScript');
SQL.Add('Where SqlCode=
SqlCode');
ParamByName('pSqlCode').AsString:=SqlCode;
Open;
if not eof then
begin
if TGraphicField(FieldByName('RptDesign')).IsNull then
begin
frReport.SaveToFile(FileName);
end
else
begin
TGraphicField(FieldByName('RptDesign')).SaveToFile(FileName);
end ;
end ;
except
on E:Exceptiondo
begin
UWriteErrLog('Xt',Self.Caption,E.Message);
UErrorMsgBox('查询报表设计文件出错,请查看出错日志!');
Result:=false;
end;
end;
finally
Free;
end;
end;