Page 1 of 1

Problems about fields with DataType ftOraClob

Posted: Wed 10 Feb 2016 10:41
by elraj71
Hi!

I use UniDAC (vers. 6.2.10) in Delphi XE2 application to access data in Oracle 11.2 Database.

In my application, I read data by TUniQuery/TDatasetProvider/TClientDataset and I have problems about fields with DataType ftOraClob.


A sample code that I used is:

Code: Select all

procedure TForm1.Button14Click(Sender: TObject);
const
  cSql =
  'SELECT * FROM PLNOTE ' +
    'WHERE IDDIP = :IDDIP AND DATA = :GIORNO ';
var
  qry: TUniQuery;
  dsp: TDatasetProvider;
  cds: TClientDataset;
begin
  qry := TUniQuery.Create(nil);
  dsp := TDataSetProvider.Create(nil);
  cds := TClientDataSet.Create(nil);
  try
    qry.Connection := SqlConnOracle;
    qry.Options.SetFieldsReadOnly := False;
    //
    dsp.DataSet := qry;
    dsp.Name := 'DSPPRESENZE';
    cds.SetProvider(Dsp);

    qry.sql.Text := cSql;
    Cds.FetchParams;
    Cds.Params.ParamByName('IDDIP').AsInteger := 1117;
    Cds.Params.ParamByName('GIORNO').AsDateTime := EncodeDate(2014, 3, 14);
    Cds.Open;
    //
    Cds.Edit;
    Cds.FieldByName('NOTE').AsString := 'mia nota'; // <------- doesn't work!!!
    Cds.Post;
    Cds.ApplyUpdates(0);
  finally
    cds.Free;
    dsp.Free;
    qry.Free;
  end;
end;
"NOTE" is a CLOB field. The problem is that Edit doesn't work. After Edit, Post, ApplyUpdates I found a Null value in field "NOTE".

why? Can I solve this problem?

Thanks in advance,
Federica

Re: Problems about fields with DataType ftOraClob

Posted: Wed 10 Feb 2016 11:35
by AlexP
Hello,

To solve the issue, you should set the DataSetProvider1.ResolveToDataSet property to True.

Re: Problems about fields with DataType ftOraClob

Posted: Thu 11 Feb 2016 09:08
by elraj71
AlexP wrote:Hello,

To solve the issue, you should set the DataSetProvider1.ResolveToDataSet property to True.
This solution solves my issue: thank you!!

Federica

Re: Problems about fields with DataType ftOraClob

Posted: Thu 11 Feb 2016 09:41
by AlexP
Glad to see that the issue was resolved. If you have any further questions, feel free to contact us.