如何打开存于数据库的word,JPG图片,WAV文件?是调用他们自己对应的打开程序来打开,如word,acdsee,meadiaplay等。

解决方案 »

  1.   

    以sqlserver为例,其中“字段1”为image类型(存放文件),“字段2”为char类型(存放文件名)。单元引用加上shellapi。
    存入数据库:
      if not OpenDialog1.Execute then exit;
      table1.insert;
      (table1.FieldByName('字段1') as TBlobField).LoadFromFile(OpenDialog1.filename);
      table1.FieldByName('字段2').value:=OpenDialog1.filename;
      table1.post;
    打开文件:
      (table1.FieldByName('字段1') as TBlobField).savetoFile(table1.FieldByName('字段2').value);
      shellexecute(handle,nil,pchar(table1.FieldByName('字段2').value),nil,nil,sw_shownormal);如果是tquery需要配合tupdatesql使用,方法相同。
      

  2.   

    jin_zai(进仔)的回答完全正确,你还有什么问题吗?