dm.ClientDataSet9.Close;
  dm.ClientDataSet9.CommandText:='';
  dm.ClientDataSet9.CommandText:='select * from yL_XX_userinf';
  dm.ClientDataSet9.Open;
  dm.ClientDataSet9.First;
  mystream := TMemoryStream.Create;
  mystream.loadfromfile(GetCurrExeDIR+'TCKWJ_YL.exe');  //将文件加载到流里
  mystream.seek(0,soFromBeginning);
    dm.ClientDataSet9.Edit;
  (dm.ClientDataSet9.FieldByName('newfile') as Tblobfield).LoadFromStream(mystream);
    dm.ClientDataSet9.ApplyUpdates(-1);

 UpdataNewFile:=Tblobfield.Create(application);
  dm.ClientDataSet9.Close;
  dm.ClientDataSet9.CommandText:='select * from Yl_xx_userinf';
  dm.ClientDataSet9.Open;
  updatanewfile:=Tblobfield(dm.ClientDataSet9.FieldByName('newfile'));
  //if not UpdataNewFile.IsNull then
  begin
    stream:=TMemoryStream.create;
    UpdataNewFile.savetostream(stream);
    //判断文件夹是否存在 如果不存在就创建
    s:= GetCurrExeDIR+'temp';
    if not DirectoryExists(s) then
        MkDir(s);
    Tblobfield(dm.ClientDataSet9.fieldbyname('newfile')).SaveTofile(GetCurrExeDIR+'temp\TCKWJ_YL.exe.exe');
    Panel1.Caption := '升级完毕!请重新启动软件';
  end;
每次只能读出0字节,不知道为什莫没写进去

解决方案 »

  1.   

    在stream:=TMemoryStream.create;前加updatanewfile.position:=0;試試.
      

  2.   

    必须把运行的程序关闭掉才可以在windows中建一个批处理文件(里面是用DOS命令把另一个文件夹的文件复制到本地目录)如果在 把此批处理文件 放到 Windows的“启动”中,则windows启动时自动更新,
    我都是这样给客户端更新的
      

  3.   

    令做一个程序b,a程序把升级文件c考到本地文件夹后,a程序调用b,b关闭a程序,再拷贝c过来;
    这样太麻烦了,我建议你升级程序单独做成aa,先下载新程序,再关了主程序bb,再拷贝。
    对了,blob那个问题我也遇到过,怎么解决的?