ASP 内部对像 Request->get_item 的使用方法

fairyprince 2006-02-06 11:29:18
我用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
...全文
162 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
fairyprince 2006-02-08
  • 打赏
  • 举报
回复
fairyprince 2006-02-07
  • 打赏
  • 举报
回复
IStringList 是列表,它保存返回的结果,这是从MSDN 查到的,按照上面的说法,如果 m_piRequest->get_Item 请求返回的如果是一个 Form, QueryString, 那么就返回一个IStringList
fairyprince 2006-02-06
  • 打赏
  • 举报
回复
这方式我会,因为用户可能是 POST 或 GET 所以用 get_item 方法
wangk 2006-02-06
  • 打赏
  • 举报
回复
应该用Request的QueryString对象或Form对象的get_Item
lovedna 2006-02-06
  • 打赏
  • 举报
回复
发错了吧! 这里没有ASP呀
XXandOO 2006-02-06
  • 打赏
  • 举报
回复
貌似调用的没有错误。。。

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.
XXandOO 2006-02-06
  • 打赏
  • 举报
回复
Item因该是一个索引器属性,不是普通的接口函数,返回的可能是枚举器接口吧,IStringList是什么接口?怎么查不到?
fairyprince 2006-02-06
  • 打赏
  • 举报
回复

3,245

社区成员

发帖
与我相关
我的任务
社区描述
ATL,Active Template Library活动(动态)模板库,是一种微软程序库,支持利用C++语言编写ASP代码以及其它ActiveX程序。
社区管理员
  • ATL/ActiveX/COM社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧