我用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.   

    发错了吧!  这里没有ASP呀
      

  2.   

    应该用Request的QueryString对象或Form对象的get_Item
      

  3.   

    这方式我会,因为用户可能是 POST 或 GET 所以用 get_item 方法
      

  4.   

    Item因该是一个索引器属性,不是普通的接口函数,返回的可能是枚举器接口吧,IStringList是什么接口?怎么查不到?
      

  5.   

    貌似调用的没有错误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 collectionVARIANT * 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. 
    Res
    You can use this method to retrieve a particular item from an array that has been returned by a Form, QueryString, or ServerVariables collection.
      

  6.   

    IStringList 是列表,它保存返回的结果,这是从MSDN 查到的,按照上面的说法,如果 m_piRequest->get_Item  请求返回的如果是一个 Form, QueryString, 那么就返回一个IStringList