Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to getdatatype of fields from my table

Status
Not open for further replies.

Vincent81

Programmer
Dec 18, 2002
9
0
0
ID
HI

i have 1 table[ms access] with 3 fields : code [number],name [text] , now [date]


i wanna perform data to datagrid but i need select datatype of fields and validate it

how to do that?
thank's
 

Vincent, it will b great if u let us know whether the last post u made regarding the tablenames in access mdb helped u or not. First try to acknowledge those who have adjusted their busy schedule to help u before posting a followup question... there are a couple of very good posts there, and i strongly feel u shud work on them first... u can adjust those code lines to get the datatypes of the fields too..

between, u can use the rst.fields(0).type, if u are using ADO. All the Best
Praveen Menon
pcmin@rediffmail.com
 
[tab]rs.Fields(i).Type

will return a numeric value which you need to "decode" to the "name". I do it with a select case block with the numeric values as the case, and return the string from each case.


MichaelRed
m.red@att.net

Searching for employment in all the wrong places
 
The type property returns a numeric value, for which there are Constants for:

rsField(i).Type = adDouble
So, you could use:

Select Case rsField(i).Type
Case adDouble

End Select

This speaks for its self and an extra comment, to identify what the numerical value is, is not needed.

But, you can check the type via the Value property, if you are only concerned with the basic variable types (string, integer, long, currency, double/single (single - which may be really be returned as a double), using:

?TypeName(rs.Fields(i).Value)

This will not be the actual field type, but the value type, which may or may not be sufficient depending on what the information is needed for. [/b][/i][/u][sub]*******************************************************
General remarks:
If this post contains any suggestions for the use or distribution of code, components or files of any sort, it is still your responsibility to assure that you have the proper license and distribution rights to do so!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top