How to create offline OLAP cube in C#?
- by jimmyjoe
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...