从ADO获取未排序的记录集
Get an unsorted recordset from ADO
我正在使用ADO从excel文件中获取表头列名。问题是数据是按排序返回的。我需要它的原始顺序。这是代码:
_RecordsetPtr pSchema->m_pCon->OpenSchema(adSchemaColumns);
// pSchema->Sort = ""; // Does not help
// pSchema->Sort = "ORDINAL_POSITION"; // Crashes
while (!pSchema->GetadoEOF())
{
string sheetName = (char*)(_bstr_t)pSchema->Fields->GetItem("TABLE_NAME")->Value.bstrVal;
if (sheetName == "MySheet")
string column = (char*)(_bstr_t)pSchema->Fields->GetItem("COLUMN_NAME")->Value.bstrVal;
pSchema->MoveNext();
}
我怎样才能使它未经排序地返回?
int ordinalPosition = (int)pSchema->Fields->GetItem("ORDINAL_POSITION")->Value.dblVal;
然后按ordinalPosition排序(从索引1开始)。
相关文章:
- 二叉排序树无法编译
- 仅使用绝对值对数组进行排序,并在C++中显示实际值
- C++选择排序算法中的逻辑错误
- 使用C++程序合并排序没有得到正确的输出
- 计算排序向量的向量中唯一值的计数
- 排序算法c++
- 使用2个键的cpp-stl::优先级队列排序不正确
- 将两个数组中的差异记录在第三个数组中
- 将结构向量排序为子组
- 在c++中尝试对对象数组进行排序时,出现std:bad_alloc错误
- 如何对点云数据进行排序
- 对字符串进行排序时,在c++中处理sort()
- 是否有类似std::lower_bound的函数,而不需要排序/分区输入
- 下面是排序算法O(n)吗
- C++ MDC final-在字符类型的数组结构中按字母顺序对记录中的名称进行排序
- 从ADO获取未排序的记录集
- 使用QSORT对大型、二进制、固定长度的记录进行排序
- 快速排序记录数组(Struct)
- 对数据结构进行排序并保存原始索引的记录
- 如何使用C++中的堆栈、队列或 BST 对文件中的记录进行排序