Retrieves the value of a column in a cursor or retrieves the value of a session variable.
To get the value of |
Use |
---|---|
A column in a cursor |
|
A session variable |
Retrieves the value of a column in a cursor.
PSCursorClass objects
cursorobject.GetValue( field )
The value of the specified column
At runtime, GetValue has the following behavior:
Application server |
Runtime behavior |
---|---|
ASP |
Accesses the named item in the Fields collection of the RecordSet object |
JSP |
Not supported |
For JSP targets, use the GetColumn<DataType> methods instead, where <DataType> is the datatype of the value you want to retrieve.
The following example retrieves the values of the “prod_id” and “prod_name” columns:
myquery = "SELECT products.prod_id, products.prod_name FROM DBA.products";
mycursor = myconnect.CreateCursor(myquery);
if ( myconnect.GetError() == null )
{
for (i=0; (!mycursor.EOF()); i++)
{
psDocument.Write(mycursor.GetValue(0) + " " + mycursor.GetValue(1));
psDocument.Write("<BR>");
mycursor.MoveNext();
}
}
else {
dberror = true;
}
if ( dberror == true )
{
errobj = myconnect.GetError();
str = errobj.GetCode() + " " + errobj.GetMessage();
psDocument.Write ( str );
}
Retrieves the value of a session variable.
PSSessionClass object
psSession.GetValue( propname )
Argument |
Description |
---|---|
propname |
The name of a session variable |
String. Returns the value of the specified session variable. If the property does not exist, GetValue returns null.
At runtime, GetValue accesses a user-defined property of the session object.
The following example retrieves the values of the UserID and Password session variables:
userid = psSession.GetValue("UserID");
password = psSession.GetValue("Password");