ADO Type attribute
Definition and usage
The Type attribute can set or return a DataTypeEnum Value, which can indicate the type of Parameter, Field, or Property object.
Object | Description of Type object |
---|---|
Parameter | For Parameter object, the Type attribute has read/write access. |
Field | For a new Field object added to the Fields collection of the Record, Type is read/write only when the Value attribute 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 Property object, the Type attribute is read-only. |
Syntax
objectname.Type
Instance
For 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 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 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 %>