| View previous topic :: View next topic |
| Author |
Message |
Jean-Michel Granier Guest
|
Posted: Thu Nov 10, 2005 11:38 am Post subject: How can we know the fields datatype and width before the rea |
|
|
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
|
|
| Back to top |
|
 |
John Shipp Guest
|
Posted: Thu Nov 10, 2005 7:07 pm Post subject: Re: How can we know the fields datatype and width before the |
|
|
dataset.Fields.Fields[x].Size;
-john
"Jean-Michel Granier" <jmgway (AT) aol (DOT) com> wrote
| 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
|
|
|
| Back to top |
|
 |
Jean-Michel Granier Guest
|
Posted: Tue Nov 15, 2005 7:42 am Post subject: Re: How can we know the fields datatype and width before the |
|
|
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" <BBushay (AT) Nmpls (DOT) com> a écrit dans le message de
news:o9v7n155gq7vp7go1a0eb295gm0pj1bl6c (AT) 4ax (DOT) com...
| 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)
[email]Bbushay (AT) NMPLS (DOT) com[/email]
|
|
|
| Back to top |
|
 |
|