Export (0) Print
Expand All
Expand Minimize

ATL Provider Error ATL2011

Only 1 inline unnamed attribute allowed per scope.

The provider has encountered multiple uses of an attribute of which only one is allowed to be unnamed.

The following sample generates ATL2011 because it contains two unnamed db_source attributes and two unnamed db_command attributes.

// ATL2011.cpp
// compile with: /c
// ATL2011 expected
#define _ATL_ATTRIBUTES
#include <atlbase.h>
#include <atldbcli.h>
 
int main()
{
 [ db_source("<Connection string to connect to Northwind database>")];
// to resolve error, change preceding line to
// [ db_source("<Connection string to connect to Northwind database>",name="nwnd")];
 [ db_source("<Connection string to connect to some other database>")];

 char szFirstName[21];
 [ db_command(db_command="([bindto] szFirstName) select FirstName from Employees")];
 char szCustomerID[6];
 [ db_command(db_command="([bindto] szCustomerID) select CustomerID from Customers")];
// to resolve error, change preceding line to
// [ db_command(db_command="([bindto] szCustomerID) select CustomerID from Customers",name="custcmd")];
} 

Community Additions

ADD
Show:
© 2014 Microsoft