Readme_AMOAdventureWorks Sample

11/05/2008 21:36:06


This sample works only with SQL Server 2005 and SQL Server 2008. It will not work with any version of SQL Server earlier than SQL Server 2005.
AMOAdventureWorks is a sample C# program that illustrates the use of the Analysis Management Objects (AMO) to create complex OLAP cubes.
Default location: C:\Program Files\Microsoft SQL Server\100\Samples\Analysis Services\Programmability\AMO\AMOAdventureWorks

Scenario

This sample creates a subset of the functionality of the AdventureWorks cube located in the AdventureWorks Analysis Services Project.

Languages

C#

Features

The SQL Server Analysis Services sample uses the following features.

Application Area Features
AMOAdventureWorks AMO


Prerequisites

Before you run this sample, you should have Microsoft SQL Server and the following SQL Server components installed:
  • SQL Server Database Engine
  • Analysis Services
  • SQL Server Management Studio
  • Business Intelligence Development Studio Note: Business Intelligence Development Studio is not supported on computers that run the Itanium-based operating system; the 64-bit development environment is supported on x64-based operating systems. SQL Server samples can be modified and run on computers that run either x86 or x64-based operating systems when databases used by the samples are deployed on an Itanium-based operating system.
  • Updated versions of the following SQL Server sample database: the AdventureWorksDW data warehouse. You can download these sample databases from the Microsoft SQL Server Samples and Community Projects web site. For more information about how to download and install sample databases, see Installing SQL Server Samples and Sample Databases in SQL Server Books Online.
  • Updated versions of the following SQL Server samples: Analysis Services and SQL Server Database Engine. You can download these samples from the Microsoft SQL Server Samples and Community Projects Web site at http://www.codeplex.com. For more information about how to download and install samples, see Installing SQL Server Samples and Sample Databases in SQL Server Books Online. You also must have .NET Framework SDK 2.0 or Microsoft Visual Studio 2005. You can obtain .NET Framework SDK free of charge. For more information, see Installing the .NET Framework SDK in SQL Server Books Online.

Building the Sample

If you have not already created a strong name key file, generate the key file using the following instructions.
To generate a strong name key file
  1. Open a Microsoft Visual Studio 2005 command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.-- or --Open a Microsoft .NET Framework command prompt. Click Start, point to All Programs, point to Microsoft .NET Framework SDK 2.0, and then click SDK Command Prompt.
  2. Use the change directory command (CD) to change the current directory of the command prompt window to the folder where the samples are installed. Note: To determine the folder where samples are located, click the Start* button, point to All Programs, point to Microsoft SQL Server, point to Documentation and Tutorials, and then click Samples Directory. If the default installation location was used, the samples are located in <system_drive>:\Program Files\Microsoft SQL Server\100\Samples.*
  3. At the command prompt, run the following command to generate the key file: sn -k SampleKey.snk Important: For more information about the strong-name key pair, see "Security Briefs: Strong Names and Security in the .NET Framework" in the .NET Development Center on MSDN.
To build the AMOAdventureWorks sample
  • Compile the sample by using Visual Studio 2005 and the provided Visual Studio solution.— or —
  • Compile the sample using Microsoft MSBuild, which is included in the .NET Framework SDK 2.0, by executing a command similar to the following at a command prompt: msbuild /nologo /verbosity:quiet /property:Configuration=Debug CS/AMOAdventureWorks.sln Other MSBuild build options can be used depending on your needs.

Running the Sample

To run the AMOAdventureWorks sample
  • In Visual Studio 2005, press F5.— or —
  • In Visual Studio 2005, on the Debug menu, click Start.— or —
  • At a command prompt, use the change directory (CD) command to go to the folder where the sample was built. In that directory, run the following command: AMOAdventureWorks.exe

See Also

Tasks
Readme_DisplayObjectNames Sample
Other Resources
SQL Server Analysis Services Samples
Help and Information
  • Getting SQL Server 2008 Assistance* © 2008 Microsoft Corporation. All rights reserved.

Last edited Mar 19, 2009 at 2:56 AM by libinzhao, version 11

Comments

jcolaizzi Aug 14, 2009 at 12:33 AM 
I'm working with Visual Studio 2005 or 2008 and the AmoAdventureWorks sample and Sql Server 2008 Standard edition. I've made two changes to the AmoAdventureworks project, both in Program.cs. First I put an immediate return in the CreateCurrencyRatesMeasureGroup method to avoid the issue of semiadditive measures not being available in the Standard Edition. Second in the CreateRolesAndPermissions method for the reader role I used this statement:

role.Members.Add(new RoleMember("EIT\test1")); // e.g. redmond\johndoe

instead of:

role.Members.Add(new RoleMember("")); // e.g. redmond\johndoe

and then

role.Update();

gets this exception:

{"The following system error occurred: No mapping between account names and security IDs was done. .\n"}


If I use this statement:

role.Members.Add(new RoleMember("EIT\test1", "S-1-5-21-107385321-1855232891-3196306309-513")); // e.g. redmond\johndoe

it runs to completion and creates the cube. That is a valid user\sid combination in our domain and as a Server Admin in Analysis Services I can browse the cube.

However if I go into SSMS 2008 and open the AmoAdventureWorks AS database, then open roles and right click on Readers -> Properties -> Membership it shows S-1-5-21-107385321-1855232891-3196306309-513 as the user for this role.

If I add a user and immediately remove that user and click ok I once again get a dialog box with:

The following system error occurred: No mapping between account names and security IDs was done.

Will someone please explain what I'm doing wrong or missing here?

Thanks