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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Find field attributes in table - OLEDB 1

Status
Not open for further replies.

Fred48

Programmer
Feb 23, 2004
62
US
Hi,

I have a need to find field attributes in a table, especially length of field and name. This information is needed for a common routine for printing reports from a table. I am converting ActiveX to .NET OLEDB and the current code is:

'ReDim arr(UBound(arrColumnName))
'For i = 0 To UBound(arr)
' s = rs.Fields(arrColumnName(i)).Name
' n = rs.Fields(arrColumnName(i)).DefinedSize

' If Len(s) > n Then n = Len(s)

' arr(i) = n
'Next i

rs is defined as a recordset; arrColumnName is defined as an OBJECT and contains the columns from a datagrid.

Again, the purpose of this code is to find the width of the data field.

As usual any help would be greatly appreciative.


 
rs.Fields(arrColumnName(i)).Size gives the number of characters of a text field
Then physical size of the text entry box or datagrid is found from the properties of that control that is bound to the table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top