How to create offline OLAP cube in C#?

Posted by jimmyjoe on Stack Overflow See other posts from Stack Overflow or by jimmyjoe
Published on 2009-11-25T16:35:23Z Indexed on 2010/03/23 23:33 UTC
Read the original article Hit count: 536

Filed under:
|

I have a problem with creating an offline OLAP cube from C# using following code:

using (var connection = new OleDbConnection())
    {
       connection.ConnectionString = "Provider=MSOLAP;  Initial Catalog=[OCWCube];  Data Source=C:\\temp\\test.cub;  CreateCube=CREATE CUBE [OCWCube] (   DIMENSION [NAME],    LEVEL [Wszystkie] TYPE ALL,    LEVEL [NAME],   MEASURE [Liczba   DESCRIPTIO]    FUNCTION COUNT  );  InsertInto=INSERT INTO OCWCube([Liczba   DESCRIPTIO], [NAME].[NAME])  OPTIONS ATTEMPT_ANALYSIS  SELECT Planners.DESCRIPTIO, Planners.NAME  FROM Planners Planners;  Source_DSN=\"CollatingSequence=ASCII;DefaultDir=c:\\temp;Deleted=1;Driver={Microsoft dBase Driver (*.dbf)};DriverId=277;FIL=dBase IV;MaxBufferSize=2048;MaxScanRows=8;PageTimeout=600;SafeTransactions=0;Statistics=0;Threads=3;UserCommitSync=Yes;\";Mode=Write;UseExistingFile=True";
        try
        {
            connection.Open();
        }
        catch (OleDbException e)
        {
            Console.WriteLine(e);
        }
    }

I keep on getting the following exception:

"Multiple-step operation generated errors. Check each OLE database status value. No action was taken."

I took the connection string literally from OQY file generated by Excel. I had to add "Mode=Write" section, otherwise I was getting another exception ("file may be in use").

What is wrong with the connection string? How to diagnose the error? Somebody please guide me...

© Stack Overflow or respective owner

Related posts about olap-cube

Related posts about c#