FieldsPtr pFields=m_pRecordset->GetFields(); long nCount=pFields->Count;//字段个数 CString strFieldName = LPCTSTR(m_pRecordset->Fields->GetItem(_variant_t(0))->GetName());//表示第0个字段名称
Compiling... ElementInfoDlg.cpp C:\fixture\code\ElementInfoDlg.cpp(462) : error C2660: 'get_Fields' : function does not take 0 parameters C:\fixture\code\ElementInfoDlg.cpp(463) : error C2064: term does not evaluate to a function C:\fixture\code\ElementInfoDlg.cpp(466) : error C2440: 'type cast' : cannot convert from 'int' to 'class _variant_t' No constructor could take the source type, or constructor overload resolution was ambiguous C:\fixture\code\ElementInfoDlg.cpp(466) : error C2227: left of '->GetName' must point to class/struct/union谢谢楼上的朋友,但是编译出现错误,帮忙看看?
'get_Fields' 这些函数是什么贴出来啊
如果是SQL Server的话 每个数据库都有一个系统表叫sysobjects,保存了该数据库所有的表名,每一个表对应一个id,另一个表syscolumns记录所有的字段,其id属性标明了该字段属于哪个表,用一个sql语句就可以搞定了,比如 select * from syscolumns where id in (select id from sysobjects where name='???') 当然用连接效率更高
long nCount=pFields->Count;//字段个数
CString strFieldName = LPCTSTR(m_pRecordset->Fields->GetItem(_variant_t(0))->GetName());//表示第0个字段名称
ElementInfoDlg.cpp
C:\fixture\code\ElementInfoDlg.cpp(462) : error C2660: 'get_Fields' : function does not take 0 parameters
C:\fixture\code\ElementInfoDlg.cpp(463) : error C2064: term does not evaluate to a function
C:\fixture\code\ElementInfoDlg.cpp(466) : error C2440: 'type cast' : cannot convert from 'int' to 'class _variant_t'
No constructor could take the source type, or constructor overload resolution was ambiguous
C:\fixture\code\ElementInfoDlg.cpp(466) : error C2227: left of '->GetName' must point to class/struct/union谢谢楼上的朋友,但是编译出现错误,帮忙看看?
每个数据库都有一个系统表叫sysobjects,保存了该数据库所有的表名,每一个表对应一个id,另一个表syscolumns记录所有的字段,其id属性标明了该字段属于哪个表,用一个sql语句就可以搞定了,比如
select * from syscolumns where id in (select id from sysobjects where name='???')
当然用连接效率更高
1,“get_Fields”等函数就是上面一个朋友给的那个方法
2,我用的是access2000,有相应的办法么