//獲取所有字段名 BOOL GetFields(CACCADO &ado) { CString sql = _T("SELECT TOP 1 * FROM tableName"); ado.OpenRecordset(sql); ADODB::_RecordsetPtr rs = ado.GetRecordsetPtr(); UINT64 colnum = rs->GetFields()->Count; CString fieldname = _T(""); for (long i = 0; i < colnum; ++i) { fieldname = (LPCSTR)rs->GetFields()->GetItem(i)->GetName(); /* ... do something ... */ } rs->Close(); return TRUE; }
***
本文出自 “walker” 博客,請務必保留此出處http://walkerqt.blog.51cto.com/1310630/1281423