【发布时间】:2014-10-07 23:12:04
【问题描述】:
我正在使用 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();
}
我怎样才能让它返回未排序?
【问题讨论】: