Hi all
I am working my way through the documentation for a walkthrough (C++):
"Walkthrough: Creating a Rich Client Application with MFC"
ms-help:
At one point, the walkthrough specifies that I should copy-paste
a code snippet into the OnInitialUpdate method of the CMyProjectView class.
The snippet implements the db_command attribute:
============================================================
<pre> 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)
============================================================
On build, the compiler has no idea as to what that stuff is, and
reacts accordingly - with several compilation diagnostics:
============================================================
Error
1 error C2143: syntax error : missing ']' before '{' c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 99 Authors-02
Error 2 error C2440: 'initializing' : cannot convert from 'HRESULT' to 'const char *' c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 98 Authors-02
Error 3 error C2143: syntax error : missing '
Error 4 error C2065: 'SELECT' : undeclared identifier c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 101 Authors-02
Error 5 error C2146: syntax error : missing '
Error 6 error C2143: syntax error : missing ')' before '[' c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 101 Authors-02
Error 7 error C2065: 'bindto' : undeclared identifier c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 101 Authors-02
Error 8 error C2146: syntax error : missing '
Error 9 error C3861: 'au_lname': identifier not found c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 101 Authors-02
Error 10 error C2059: syntax error : ')' c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 101 Authors-02
Error 11 error C2146: syntax error : missing '
Error 12 error C2065: 'FROM' : undeclared identifier c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 103 Authors-02
Error 13 error C2146: syntax error : missing '
Error 14 error C2065: 'AUTHORS' : undeclared identifier c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 103 Authors-02
Error 15 error C2143: syntax error : missing '
Error 16 error C2143: syntax error : missing '
Error 17 error C2065: 'cmd' : undeclared identifier c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 105 Authors-02
Error 18 error C2228: left of '.MoveNext' must have class/struct/union c:\projects\aaaplayground\walkthroughs\authors-02\authors-02\authors-02view.cpp 105 Authors-02
Error 19 fatal error C1903: unable to recover from previous error(s)
============================================================
How do I get the compiler to recognise the attribute?
What am I missing here?
I'm using Visual Studio 2008.
Thanks!!!