ADO Type Attribute

Definition and Usage

Ang Type attribute ay maaring itakda o ibalik ng isang DataTypeEnum Value, na maaring indikahin ang uri ng Parameter, Field o Property object.

Object Description ng Type object
Parameter Para sa Parameter objekto, ang Type attribute ay may read/write access.
Field Para sa bagong Field objekto na naipasok sa Record Fields collection, ang Type ay read/write lamang kapag ang Value attribute ng Field ay naitatalaga at matagumpay na idinagdag ng data provider sa pamamagitan ng pagtawag sa Update method ng Fields collection.
Property Para sa Property objekto, ang Type attribute ay read-only.

Syntax

objectname.Type

Instance

Para sa Field objekto:

<%
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
%>

Para sa Parameter objekto:

<%
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
%>

Para sa Property objekto:

<%
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")
Ipalabas ang mga attribute ng property ng Table ng Orders
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
%>