在savetofile前首先确认ClientDataSet的Active = true if clientdataset.Acitve then clientdataset.savetofile(filename); 你出错的提示信息?
with DmMain do begin if cds_MainTV.Active then cds_MainTV.Close; cds_MainTV.Params.ParamValues['@ID'] := 1;//存储过程参数 cds_MainTV.Open; szFilePath := ExtractFilePath(Application.ExeName); szFilePath := szFilePath + 'Client\1'+ ; cds_MainTV.FileName := szFilePath; cds_MainTV.SaveToFile;//出错 end;错误信息:EFCreateError with the message "cannot create file ..."
难道没有人知道吗?这大一个CSDN,就没有一个人知道吗?
cds_MainTV.SaveToFile;//出错
要有参数,将你的路径作为参数 with DmMain do begin if cds_MainTV.Active then cds_MainTV.Close; cds_MainTV.Params.ParamValues['@ID'] := 1;//存储过程参数 cds_MainTV.Open; szFilePath := ExtractFilePath(Application.ExeName); szFilePath := szFilePath + 'Client\1'+ ; cds_MainTV.FileName := szFilePath;//这一句什么意思?????,删掉 cds_MainTV.SaveToFile(szfilepath);//加参数 end
if clientdataset.Acitve then
clientdataset.savetofile(filename);
你出错的提示信息?
begin
if cds_MainTV.Active then cds_MainTV.Close;
cds_MainTV.Params.ParamValues['@ID'] := 1;//存储过程参数
cds_MainTV.Open;
szFilePath := ExtractFilePath(Application.ExeName);
szFilePath := szFilePath + 'Client\1'+ ;
cds_MainTV.FileName := szFilePath;
cds_MainTV.SaveToFile;//出错
end;错误信息:EFCreateError with the message "cannot create file ..."
要有参数,将你的路径作为参数
with DmMain do
begin
if cds_MainTV.Active then cds_MainTV.Close;
cds_MainTV.Params.ParamValues['@ID'] := 1;//存储过程参数
cds_MainTV.Open;
szFilePath := ExtractFilePath(Application.ExeName);
szFilePath := szFilePath + 'Client\1'+ ;
cds_MainTV.FileName := szFilePath;//这一句什么意思?????,删掉
cds_MainTV.SaveToFile(szfilepath);//加参数
end
加上参数一样错!
cds_MainTV.SaveToFile(szFilePath,dfXML);
因为你一旦从从文件打开一次,这个数据集delphi就没有释放,
具体原因不清.然后在open之后直接:
cds_MainTV.SaveToFile(szFilePath,dfXML);//cds_MainTV.FileName := szFilePath;这一行不能要