如何从变量数组中检索元素. [英] how to retrive element from variant array.
本文介绍了如何从变量数组中检索元素.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有类似
的变体变量
variant_t avarData;
我使用
将记录集转换为变量数组
avarData = m_pRS-> GetRows(a);
现在我想使用avardata(0,0)从变量数组访问元素
但这给我带来了错误,因为术语不能评估为带有2个参数的函数.
i have variant variable like
variant_t avarData;
i convert recordset to variant array using
avarData = m_pRS->GetRows(a);
now i want to access element from variant array using avardata(0,0)
but this gives me error as term does not evaluate to a function taking 2 arguments
推荐答案
大括号"()
"实际上是为<中的函数调用保留的c1>(我们使用"[]
"访问数组项).
无论如何,您不能使用标准的方式访问数组项,因为GetRows
返回"SAFEARRAY
野兽".您可以通过variant_t
的parray
成员访问safearray.例如,请参见以下线程 [ ^ ].
Round brackets ''()
'' are actually reserved for function calls inC++
(we use ''[]
'' for accessing array items).
Anyway you cannot use the standard way for accessing array items, sinceGetRows
returns a ''SAFEARRAY
beast''. You may access the safearray via thevariant_t
''sparray
member. See, for instance, the following thread[^].
这篇关于如何从变量数组中检索元素.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文