描述:
我用VC做一个ASP组件,要读出用户提交的数据,我使用get_item方法如下:
Name 是一个BSTR 字串
HRESULT hr = S_OK;
IDispatch* pDisp = NULL;
IStringList* pStringList = NULL;
m_piRequest->get_Item(Name,&pDisp);
pDisp->QueryInterface(IID_IStringList,(void**)&pStringList);
_variant_t var;
hr = S_OK;
hr=pStringList->get_Item(_variant_t(Name),&var);
if (FAILED(hr))
m_piResponse->Write(_variant_t("返回字串失败"));
但总返回 “返回字串失败” 就是说 pStringList->get_Item 失败,找了好多也没结果,在这里请教高手,正确的使用方法是什么,谢谢!
用户提交的数据可能是 POST 方式和 GET
解决方案1:
貌似调用的没有错误。。。
IStringList::get_ItemThe IStringList::get_Item method retrieves an individual item from a string list.
HRESULT get_Item(
VARIANT Var, // contains the name of the item in the collection
VARIANT * pVariantReturn
//pointer to a VARIANT that receives the item value
);
Parameters
Var
[in] A VARIANT that contains the name of the item in the collection.
pVariantReturn
[retval] [out] Points to a VARIANT that receives the item value.
Remarks
You can use this method to retrieve a particular item from an array that has been returned by a Form, QueryString, or ServerVariables collection.
Item因该是一个索引器属性,不是普通的接口函数,返回的可能是枚举器接口吧,IStringList是什么接口?怎么查不到?
解决方案3:发错了吧! 这里没有ASP呀
解决方案4:应该用Request的QueryString对象或Form对象的get_Item