我的代码:
procedure Tfrmdbftooracle.btnsaveClick(Sender: TObject);
var
  TD: TTransactionDesc;
  strm:tmemorystream;
begin
  inherited;
  strm:=tmemorystream.Create;
  if not SQLCon.InTransaction then
  begin
    TD.TransactionID := 1;
    TD.IsolationLevel := xilREADCOMMITTED;
    SQLCon.StartTransaction(TD);    try
      q.Close;
      q.SQL.Clear;
      q.SQL.Add('insert into xs (xh,photo) values (''00005'',:photo)');
      image1.Picture.Graphic.SaveToStream(strm);
      q.ParamByName('photo').LoadFromStream(strm,ftBlob);// .LoadFromFile(opendialog1.FileName,ftOraBlob);
      q.ExecSQL(false);
      SQLCon.Commit(TD); {on success, commit the changes};
    except
      SQLCon.Rollback(TD); {on failure, undo the changes};
    end;
  end;
      strm.free;
end;
运行后总提示:"mulpitle transactions not enabled",错在哪里?

解决方案 »

  1.   

    小弟修改Tsqlconnection控件的mulpitle transactions 属性后,解决了上次的提的问题,但是运行后,又出现了另一个问题:
    "ORA-22275:指定的LOB定位器无效",为什么?
    原码如下:
    procedure Tfrmdbftooracle.btnsaveClick(Sender: TObject);
    var
      TD: TTransactionDesc;
      strm:tmemorystream;
    begin
      inherited;
      strm:=tmemorystream.Create;
      if not SQLCon.InTransaction then
      begin
        TD.TransactionID := 1;
        TD.IsolationLevel := xilREADCOMMITTED;
        SQLCon.StartTransaction(TD);
        try
          q.Close;
          q.SQL.Clear;
          q.SQL.Add('insert into xs (xh,photo) values (''00005'',:photo)');
          image1.Picture.Graphic.SaveToStream(strm);
          strm.Position :=0;
          q.ParamByName('photo').LoadFromStream(strm,ftOraBlob);
          q.ExecSQL(false);
          SQLCon.Commit(TD); {on success, commit the changes};
        except
          SQLCon.Rollback(TD); {on failure, undo the changes};
        end;
      end;
      strm.free;
    end;