Hello all,
I am just starting to learn Visual C++ using a Microsft Visual Studio walkthrough, but I have syntax errors in the following code:
HRESULT hr = S_OK;
TCHAR szAuthor[80];
CMyProjectSet &dbset = GetDocument()->m_MyProjectSet;
[db_command(name="cmd", source_name="dbset", hresult=hr)
{
SELECT au_lname
([bindto]szAuthor)
FROM AUTHORS
}];
while(cmd.MoveNext() == S_OK)
m_DataList.InsertString(-1, szAuthor);
Following is a list of errors:
Error 10 error C2059: syntax error : ')' myprojectview.cpp 101
Error 14 error C2065: 'AUTHORS' : undeclared identifier myprojectview.cpp 103
Error 7 error C2065: 'bindto' : undeclared identifier myprojectview.cpp 101
Error 17 error C2065: 'cmd' : undeclared identifier myprojectview.cpp 105
Error 12 error C2065: 'FROM' : undeclared identifier myprojectview.cpp 103
Error 4 error C2065: 'SELECT' : undeclared identifier myprojectview.cpp 101
Error 6 error C2143: syntax error : missing ')' before '[' myprojectview.cpp 101
Error 16 error C2143: syntax error : missing ';' before ']' myprojectview.cpp 103
Error 3 error C2143: syntax error : missing ';' before '{' myprojectview.cpp 99
Error 15 error C2143: syntax error : missing ';' before '}' myprojectview.cpp 103
Error 1 error C2143: syntax error : missing ']' before '{' myprojectview.cpp 99
Error 5 error C2146: syntax error : missing ';' before identifier au_lname' myprojectview.cpp 101
Error 13 error C2146: syntax error : missing ';' before identifier 'AUTHORS' myprojectview.cpp 103
Error 11 error C2146: syntax error : missing ';' before identifier 'FROM' myprojectview.cpp 102
Error 8 error C2146: syntax error : missing ';' before identifier 'szAuthor' myprojectview.cpp 101
Error 18 error C2228: left of '.MoveNext' must have class/struct/union myprojectview.cpp 105
Error 2 error C2440: 'initializing' : cannot convert from 'HRESULT' to 'const char *' myprojectview.cpp 98
Error 9 error C3861: 'au_lname': identifier not found myprojectview.cpp 101
Error 19 fatal error C1903: unable to recover from previous error(s); stopping compilation myprojectview.cpp 105
Any help will be really appreciated.
Thank you,
ARMC

Help with db_command
Craig Harry - Microsoft
Yes, there are breaking changes for the attribute syntax in VC2005. http://msdn2.microsoft.com/en-us/library/ms177253.aspx contains such details. Applying such change should fix the problem.
Nevertheless, the walkthtough should be compatible. Hence, I would recommend logging a documentation bug at http://lab.msdn.microsoft.com/productfeedback/default.aspx.
Thanks in advance for taking the time to log the doc issue!
BTW, I deleted your other post regarding the same walkthrough.
Thanks, Ayman Shoukry VC++ TeamDayan_07
Creating a rich client application with mfc.
http://msdn2.microsoft.com/en-us/library(d=robot)/6asz720a.aspx
I am using Visual Studio 2005 Version 8.0.50727.42 on Windows XP Professional.
Thank you,
Naimisar
Could you point us to the walkthroughs you are using Also, which version of VS are you using
Thanks, Ayman Shoukry vC++ TeamMincheoul Kim
I have more information on this. It works on Visual Studio 2003. Is there any syntax difference between VS 2003 and VS 2005 for the db_command