#1 2016-12-16 06:52:30

firstfriday
Member
Registered: 2015-07-21
Posts: 26

Determine the Field/Datatype of a Query

I ' am using your TQuery wrapper.

How can I find out the datatype of the fields of a query? Similar to the ado function:
Query.Fields[0].DataType

Specially to find out type boolean and memo, text.

SQLDBConnection:=props.NewConnection;
Query := TQuery.Create(SQLDBConnection);
Query.sql.add('select * from mytable');

Query.Fields[0].DataType ???

Thank you

Offline

#2 2017-01-12 16:31:40

Shapoval
Member
Registered: 2017-01-12
Posts: 5

Re: Determine the Field/Datatype of a Query

I've had the same question and examined the sources to find the answer. As far as I can see, data type of any field in a TQuery result set may be obtained the following way:

Query.PreparedSQLDBStatement.ColumnType(i)

where i is the column index.

Offline

Board footer

Powered by FluxBB