BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How can we know the fields datatype and width before the rea

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Jean-Michel Granier
Guest





PostPosted: Thu Nov 10, 2005 11:38 am    Post subject: How can we know the fields datatype and width before the rea Reply with 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
John Shipp
Guest





PostPosted: Thu Nov 10, 2005 7:07 pm    Post subject: Re: How can we know the fields datatype and width before the Reply with quote



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





PostPosted: Tue Nov 15, 2005 7:42 am    Post subject: Re: How can we know the fields datatype and width before the Reply with quote



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
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.