ADO Value Property
Definition and usage
The Value property can set or return the value of Parameter, Field, or Property objects.
Object | Description of the Value property |
---|---|
Parameter |
The Value value can set or return a variant value indicating the value of the Parameter object. Note: You should close the Recordset object before reading the Value property. For Parameter objects, ADO reads the Value property from the provider only once. |
Field |
The Value property can set or return a variant value indicating the current value of the Field object. Note: For a new Field object added to the Record's Fields collection, you must first set the Value property and call the Fields collection's Update before setting any other properties. |
Property |
The Value property can set or return a variant value indicating the current value of the Property object. Note: You cannot set the Value for read-only properties. |
Syntax
objectname.Value
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).Value) 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 />") next rs.close conn.close set rs=nothing set conn=nothing %>