IAppFrameWork::RequestTime Method [C++]

Use this method to retrieve a value from a URL query string or form post variable and convert the string to a Date Variant, based on the specified or default locale.

Definition

[C++]

HRESULT IAppFrameWork::RequestTime(BSTRbstrName,
  VARIANTvtDefault,
  VARIANTvtMin,
  VARIANTvtMax,
  VARIANTvtLocale,
  VARIANT*pvtRet);

[Visual Basic]

Function RequestTime(bstrName As String,
  Optional vtDefault As Variant,
  Optional vtMin As Variant,
  Optional vtMax As Variant,
  Optional vtLocale As Variant) As Variant

Parameters

  • bstrName[C++]
    [in] A BSTR that contains the name of the URL query string or form post variable to retrieve.
  • bstrName[Visual Basic]
    A String that contains the name of the URL query string or form post-variable to retrieve.
  • vtDefault[C++]
    [in, optional] A VARIANT that contains the string to return if the specified URL query string or form post variable does not exist or contains no value. If this parameter is not supplied, the method returns NULL. The default cannot contain DateTime or Date values.
  • vtDefault[Visual Basic]
    A Variant that contains the string to return if the specified URL query string or form post variable does not exist or contains no value. If this parameter is not supplied, the method returns NULL. The default cannot contain DateTime or Date values. This parameter is optional.
  • vtMin[C++]
    [in, optional] A VARIANT that contains the time value that specifies the low end of the range against which to validate the bstrName parameter. If the VARIANT is of type vtMissing, the vtMin parameter value is not considered in the validation process. If the converted value is less than vtMin, then NULL is returned.
  • vtMin[Visual Basic]
    A Variant that contains the time value that specifies the low end of the range against which to validate the bstrName parameter. The default is no low-end validation. This parameter is optional. If the converted value is less than vtMin, then NULL is returned.
  • vtMax[C++]
    [in, optional] A VARIANT that contains the time value that specifies the high end of the range against which to validate the bstrName parameter. If the variant is of type vtMissing, the vtMax parameter value is not considered in the validation process. If the converted value is greater than vtMax, then NULL is returned.
  • vtMax[Visual Basic]
    A Variant that contains the time value that specifies the high end of the range against which to validate the bstrName parameter. The default is no high-end validation. If the converted value is greater than vtMax, then NULL is returned. This parameter is optional.
  • vtLocale[C++]
    [in, optional] A VARIANT that contains the number that specifies the locale to use to convert the DateTime value. If this value is not specified, the RequestTime method uses the value of the Locale property of the DataFunctions object.
  • vtLocale[Visual Basic]
    A Variant that contains the number that specifies the locale to use to convert the DateTime value. If this value is not specified, the RequestTime method uses the value of the Locale property of the DataFunctions object. This parameter is optional.
  • pvtRet[C++]
    [out, retval] A pointer to a VARIANT used to return the date. If any validation fails, the value will be set to NULL.

Return Values

[C++] This method returns an HRESULT indicating whether it completed successfully. See the Error Values section for more details.

[Visual Basic] If this method completes successfully, it returns a Variant that contains the date. If any validation fails, the return value will be NULL.

Error Values

[C++] This method returns S_OK (0x00000000) to indicate success and standard COM HRESULT error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object, which can be accessed using the API function GetErrorInfo. In particular, the GetDescription method of the IErrorInfo interface may return a text description of the error.

[Visual Basic] This method sets the Number property of the global Err object to S_OK (&H00000000) to indicate success and to standard COM error values to indicate failure. For more information about standard COM errors, see Standard COM Errors. Additional information may be available using the global Err object. In particular, the Description property may contain a text description of the error.

Remarks

[C++] The pvtRet parameter points to valid data only if the method completed successfully. If any validation fails, the pvtRet parameter will be NULL.

This method converts the specified String based on the locale specified in the vtLocale parameter if the vtLocale parameter is specified; otherwise it uses the default locale found in the DataFunctions object. It validates the result of the conversion against the vtMin and vtMax parameters, if they are specified. If the validation fails this method returns NULL.

For more information about memory ownership issues related to COM property and method parameters, see Managing COM Parameter Memory.

Example

[Visual Basic]

' oAppFrameWork is a Commerce.AppFrameWork object.
' This example assumes that the time value is entered using 
' the following form:
<FORM METHOD ="POST" ACTION="PROCESS.ASP">
<INPUT TYPE="Text" NAME="Time">
<INPUT TYPE="SUBMIT" NAME="ACTION" VALUE="Send Info">
</FORM>
' If the user enters the date into the form and clicks 
' the Send Info button, the value of this form field can 
' be retrieved by the RequestTime method as follows:
vTime = oAppFrameWork.RequestTime("Time", "12:00:01 AM", _
    "12:00:01 AM", "11:59:59 PM", 1033)

See Also

[C++]AppFrameWork Object

[C++]IDataFunctions_4_0::get_Locale, put_Locale

[C++]IDataFunctions_4_0::ConvertTimeString

[C++]IAppFrameWork::RequestDate

[Visual Basic]AppFrameWork Object

[Visual Basic]DataFunctions.Locale

[Visual Basic]DataFunctions.ConvertTimeString

[Visual Basic]AppFrameWork.RequestDate

Copyright © 2005 Microsoft Corporation.
All rights reserved.