Board index » off-topic » How can we know the fields datatype and width before the real execution of the tquery ?

How can we know the fields datatype and width before the real execution of the tquery ?


2005-11-10 07:23:29 PM
off-topic8
Hi,
I would like to know the datatype and width of each field of a Tquery or
TADOQuery before the query is really executed.
Today I enforce the width of Tfieldstring to 255 instead of 20. But for
several queries, fields may have more than 255 characters. So I have only
the 255 first characters retrieved.
Help please it is urgent.
I Use D5 C/S on Oracle and SqlServer Databases.
Thank you
Jean-Michel
 
 

Re:How can we know the fields datatype and width before the real execution of the tquery ?

Hi,
I would like to know the datatype and width of each field of a TADOQuery
before the query is really executed.
Today I enforce the width of Tfieldstring to 255 instead of 20. But for
several queries, fields may have more than 255 characters. So I have only
the 255 first characters retrieved.
Help please it is urgent.
I Use D5 C/S on Oracle and SqlServer Databases.
Thank you
Jean-Michel
 

Re:How can we know the fields datatype and width before the real execution of the tquery ?

dataset.Fields.Fields[x].Size;
-john
"Jean-Michel Granier" < XXXX@XXXXX.COM >wrote in message
Quote
Hi,



I would like to know the datatype and width of each field of a TADOQuery
before the query is really executed.

Today I enforce the width of Tfieldstring to 255 instead of 20. But for
several queries, fields may have more than 255 characters. So I have only
the 255 first characters retrieved.


Help please it is urgent.

I Use D5 C/S on Oracle and SqlServer Databases.

Thank you

Jean-Michel


 

{smallsort}

Re:How can we know the fields datatype and width before the real execution of the tquery ?

Hello Brian,
Thank you for the 2 solutions.
I will test the tow and will tell you the best one.
have a nice day.
Regards
Jean-Michel
"Brian Bushay TeamB" < XXXX@XXXXX.COM >a écrit dans le message de
Quote

>
>
>I would like to know the datatype and width of each field of a TADOQuery
>before the query is really executed.
>
>Today I enforce the width of Tfieldstring to 255 instead of 20. But for
>several queries, fields may have more than 255 characters. So I have only
>the 255 first characters retrieved.
>
>
>Help please it is urgent.
>
>I Use D5 C/S on Oracle and SqlServer Databases.
That all depends on what you are asking. Delphi needs to query your
database to
find out field information. If you are creating your queries at design
time you
can create persistent fields. The persistent fields will give you the
information you are looking for.

If you are creating your query at runtime you will need to query the
database
one why or another. You could use AdoConnection.OpenSchema to get the
field
information for the tables in the query and figure it out that way but the
fastest way to get it would be to run your query with a condition that
returned
no data.
--
Brian Bushay (TeamB)
XXXX@XXXXX.COM