我先介绍一下我的程序->我就用了bde的query 和datebase 还有两个按扭
我是用oracle建的库。数据库的初使化为create table test(a int,b blob)
bde中datebase的设置就不用我说了吧?
希望大哥们能帮帮小妹一把。
bde 代码如下(保证一点问题也没有):
unit Unit3;interfaceuses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, DBTables;type
  TForm1 = class(TForm)
    Database1: TDatabase;
    Query1: TQuery;
    Button1: TButton;
    Button2: TButton;
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
  private
    No : Integer;
  public
    { Public declarations }
  end;var
  Form1: TForm1;implementation{$R *.dfm}procedure TForm1.Button1Click(Sender: TObject);
var
  S : TStream;
begin
  //create table test(a int,b blob);已经存在
  S := TFileStream.Create('c:\1.txt', fmOpenRead);
   //必须要在c盘的路径下面 新建一个1.txt
  try
    Inc(No);
    with Query1 do
      begin
      SQL.Text := 'INSERT INTO TEST(A, B) VALUES(:A, :B)';
      ParamByName('A').AsInteger := No;
      ParamByName('B').LoadFromStream(S, ftBlob);
      ExecSQL;
      end;
  finally
    S.Free;
  end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
inc(no);
  with Query1 do
    begin
    SQL.Text := 'SELECT A, B FROM TEST';
    Open;
    TBlobField(FieldByName('B')).SaveToFile('c:\'+inttostr(no)+'.txt');
    Close;
    end;
end;end.

解决方案 »

  1.   

    你说BDE转ADO什么意思啊?
    把上面的程序改成用ADO的?从文件中读数据写入数据表;从数据表中读数据再存入文件?
      

  2.   

    我这次变了一下
    代码如下
    procedure TForm1.Button1Click(Sender: TObject);
    var
      s:tstream;
    begin
    inc(no);
    opendialog1.Filter:='excel files (*.xls)|*.TXT|all files (*.*)|*.*';
    //opendialog1.Files.AddStrings('c:\');
    opendialog1.Execute;
    if opendialog1.FileName<>'' then
            begin
            s:=tfilestream.Create(opendialog1.FileName,fmopenread);
            showmessage(opendialog1.FileName);
            adoquery1.SQL.Clear;
            adoquery1.SQL.Add('insert into test(a,b) values(:a,:b))');
            adoquery1.Parameters[0].Value:=no;
            showmessage(inttostr(adoquery1.Parameters[0].Value));
            adoquery1.Parameters[1].LoadFromStream(s,ftblob);
            adoquery1.ExecSQL;
            end
           else
           showmessage('请选择你要存储的表');
    end;
    可是弹出的信息是这样的-->
    project project1.exe raised exception class eoleException with message'ora_06413:连接未打开' process stopped use step or run to continue