Page 1 of 1

How to add columns to TOraLoader at runtime

Posted: Mon 20 Nov 2017 18:02
by jjeffman
Hello,

I am using ODAC v 9.7.26 on C++Builder 6.0 and I would like to add columns to a TOraLoader component at runtime.

I could not find any sample in the Help file, and the C++Builder demo is a little bit poor.

I was not able to find out how to add a TDAColumn to the Columns property of TOraLoader.

How can I do that? I am able to deal with Delphi code.

Thank you very much.

Best regards,

Jayme Jeffman Filho

Re: How to add columns to TOraLoader at runtime

Posted: Mon 20 Nov 2017 20:09
by jjeffman
Never mind. I have got it to work using the same process used to add columns to a TDBGrid.

Best regards,

Jayme Jeffman Filho

Re: How to add columns to TOraLoader at runtime

Posted: Wed 22 Nov 2017 13:12
by MaximG
You can add columns to TOraLoader at runtime as follows. For example, for an integer field "ID" :

Code: Select all

  ...
  TDAColumn* NewColumn;

  NewColumn = (TDAColumn*)OraLoader -> Columns -> Add();
  NewColumn -> Name = "ID";
  NewColumn -> FieldType = ftInteger;
  ...

Re: How to add columns to TOraLoader at runtime

Posted: Wed 22 Nov 2017 15:51
by jjeffman
Hello Maxim,

Thank you very much for answerung me.

I did as you suggested, but as the application is connected to the database, and I need to fill up all tables fields, I am using the TOraLoader::CreateColumns() method every time I change the TOraLoader::TableName property, that did the trick.

Thank you very much.

Best regards,

Jayme Jeffman Filho

Re: How to add columns to TOraLoader at runtime

Posted: Thu 23 Nov 2017 12:12
by MaximG
You are absolutely right. The CreateColumns method creates all the fields of the table specified in the TableName property : https://www.devart.com/odac/docs/?devar ... umns().htm