VC++ 编译未通过
#pragma once
#include "resource.h"
BOOL CDyanmicMenuDlg::IsHaveSubMenu(CString str)
{
_ConnectionPtr m_con;
_RecordsetPtr m_record;
m_con.CreateInstance("ADODB.Connection");
m_record.CreateInstance("ADODB.Recordset");
m_con->ConnectionString=m_pCon->ConnectionString;
m_con->Open("","","",-1);
CString sql;
sql.Format("select * from tb_menuinfo where 上级菜单='%s'",str);
m_record=m_con->Execute(_bstr_t)sql,NULL,adCmdText);
if((!m_record->BOF)&&(!m_record->ADOEOF))
{
return TRUE;
}
return FALSE;
}
BOOL CDyanmicMenuDlg::LoadSubMenu(CMenu* m_menu,String str)
{
_ConnectionPtr m_con;
_RecordsetPtr m_record;
m_con.CreateInstance("ADODB.Connection");
m_record.CreateInstance("ADODB.Recordset");
m_con->ConnectionString=m_pCon->ConnectionString;
m_con->Open("","","",-1);
CString sql;
sql.Format("select * from tb_menuinfo where 上级菜单='%s'",str);
m_record=m_con->Execute(_bstr_t)sql,NULL,adCmdText);
CMenu m_tempmenu;
m_tempmenu.CreatePopMenu();
if(((!m_record->ADOEOF))
{
CString c_menustr=m_record->GetCollect("菜单名称"),bstrVal;
m_tempmenu.AppendMenu(MF_STRING-1,c_menustr);
if(IsHaveSubMenu(c_menustr))
LoadSubMenu(&m_tempmenu,c_menustr);
m_record->MoveNext();
mayanjun4.cpp
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(4) : error C2653: 'CDyanmicMenuDlg' : is not a class or namespace name
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(6) : error C2065: '_ConnectionPtr' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(6) : error C2146: syntax error : missing ';' before identifier 'm_con'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(6) : error C2065: 'm_con' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(7) : error C2065: '_RecordsetPtr' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(7) : error C2146: syntax error : missing ';' before identifier 'm_record'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(7) : error C2065: 'm_record' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(8) : error C2065: 'm_con' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(8) : error C2228: left of '.CreateInstance' must have class/struct/union
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(9) : error C2065: 'm_record' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(9) : error C2228: left of '.CreateInstance' must have class/struct/union
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(10) : error C2065: 'm_con' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(10) : error C2227: left of '->ConnectionString' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(10) : error C2065: 'm_pCon' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(10) : error C2227: left of '->ConnectionString' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(11) : error C2065: 'm_con' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(11) : error C2227: left of '->Open' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(13) : error C2664: 'void ATL::CStringT<BaseType,StringTraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [46]' to 'const wchar_t *'
1> with
1> [
1> BaseType=wchar_t,
1> StringTraits=ATL::StrTraitATL<wchar_t,ATL::ChTraitsCRT<wchar_t>>
1> ]
1> Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(14) : error C2065: 'm_record' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(14) : error C2065: 'm_con' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(14) : error C2227: left of '->Execute' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(14) : error C2065: '_bstr_t' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(14) : error C2146: syntax error : missing ';' before identifier 'sql'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(14) : error C2065: 'adCmdText' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(14) : error C2059: syntax error : ')'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(15) : error C2065: 'm_record' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(15) : error C2227: left of '->BOF' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(15) : error C2065: 'm_record' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(15) : error C2227: left of '->ADOEOF' must point to class/struct/union/generic type
1> type is ''unknown-type''
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(21) : error C2653: 'CDyanmicMenuDlg' : is not a class or namespace name
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(21) : error C2065: 'CMenu' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(21) : error C2065: 'm_menu' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(21) : error C2065: 'String' : undeclared identifier
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(21) : error C2146: syntax error : missing ')' before identifier 'str'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(21) : error C2078: too many initializers
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(21) : error C2059: syntax error : ')'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(22) : error C2143: syntax error : missing ';' before '{'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(22) : error C2447: '{' : missing function header (old-style formal list?)
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(47) : error C2059: syntax error : 'if'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(49) : error C2059: syntax error : 'if'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(51) : error C2059: syntax error : '}'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(51) : error C2143: syntax error : missing ';' before '}'
1>d:\我的文档\visual studio 2008\projects2\mayanjun4\mayanjun4\mayanjun4.h(51) : error C2059: syntax error : '}'
1