ADO Type property

Definition and usage

The Type property can be set or returned as a DataTypeEnum Value, which can indicate the type of the Parameter, Field, or Property object.

Object Description of the Type object
Parameter For the Parameter object, the Type property has read/write access.
Field For a new Field object added to the Fields collection of the Record, the Type is read/write only when the Value property of the Field has been specified and the data provider has successfully added the new Field by calling the Update method of the Fields collection.
Property For the Property object, the Type property is read-only.

Syntax

objectname.Type

Instance

For the Field object:

<%
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).Type)
rs.Close
conn.close
%>

For the Parameter object:

<%
set comm=Server.CreateObject("ADODB.Command")
set para=Server.CreateObject("ADODB.Parameter")
para.Type=adVarChar
para.Size=25
para.Direction=adParamInput
para.Value=varfname
comm.Parameters.Append para
%>

For the Property object:

<%
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
set prop=Server.CreateObject("ADODB.Property")
'Display the property attributes of the Orders Table
for each prop in rs.Properties
  response.write("Attr:" & prop.Attributes & "<br />")
  response.write("Name:" & prop.Name & "<br />")
  response.write("Value:" & prop.Value & "<br />")
  response.write("Type:" & prop.Type & "<br />")
next
rs.close
conn.close
set rs=nothing
set conn=nothing
%>