在DELPHI +ORACLE 开发C/S时,如何插入含有BLOB字段的记录,又怎么读出BLOB记录,打印BLOB字段了??
谢了!!!!!!等待中。

解决方案 »

  1.   

    主要是图片,怎么存入BLOB字段中,怎么读出,谢!@!
      

  2.   

    我用的是sql-server不知道合适不:图片保存进数据库表字段
    var
      bmp1: Tbitmap;
      stream1: TMemorystream;
    begin
      bmp1:= Tbitmap.Create;
      stream1 := TMemorystream.Create;
      bmp1.SaveToStream(stream1);
      TBlobField(adoquery1.Fields[0]).LoadFromStream(stream1);
    end
      

  3.   

    上面写差了一句,不好意思
    bmp1.LoadFromFile('E:\This Week\惠州无线资源管理项目\pictures\zuhezaixian2.bmp');
      

  4.   

    //存文件到SQL数据库 字段为image 类型
    var
      fs: TFileStream;
    begin
      if not FileExists(edtFileName.Text) then
      begin
        Application.MessageBox(PChar('找不到文件' + edtFileName.Text), '错误', MB_ICONERROR);
        Exit;
      end;
      fs := TFileStream.Create(edtFileName.Text, fmOpenRead);
      ADOTable1.Append;
      try
        fs.Position := 0;
        TBlobField(ADOTable1.FieldByName('document')).LoadFromStream(fs);
        ADOTable1.Post;
      finally
        fs.Free;
      end;
    end;
    ***********************************************
    //显示
    var filename, dir: string;
    begin
      dir := ExtractFilePath(ParamStr(0)) + 'temp';
      if not DirectoryExists(dir) then
        CreateDir(dir);
      try
        fileName := dir + '\temp' + ADOTable1.FieldByName('id').AsString
          + ADOTable1.FieldByName('ext').AsString;
        TBlobField(ADOTable1.FieldByName('document')).SaveToFile(fileName);
        ShellExecute(handle, 'Open', PChar(fileName), nil, nil, SW_NORMAL);
      finally
      end;