ADO DefinedSize and ActualSize Attributes

Definition and Usage

The DefinedSize attribute returns a long value indicating the length (in bytes) defined for a field.

The ActualSize attribute is a read-only attribute. It returns a long value indicating the actual length of the value of a field. If ADO cannot determine the length of the value of the Field object, it returns adUnknown.

The DefinedSize attribute can be used to determine the data capacity of the Field object, while ActualSize indicates its actual length.

Syntax

objrs.Fields(number).DefinedSize 
objrs.Fields(number).ActualSize

Example

<%
set conn=Server.CreateObject("ADODB.Connection")
conn.Provider="Microsoft.Jet.OLEDB.4.0"
conn.Open "c:/webdata/northwind.mdb"
set rs=Server.CreateObject("ADODB.Recordset")
rs.open "Select * from orders", conn
response.write(rs.Fields(0).DefinedSize)
response.write(rs.Fields(0).ActualSize)
rs.Close
conn.close
%>