如何在C#中创建离线OLAP立方体?

发布于 2024-08-12 14:48:02 字数 1178 浏览 6 评论 0原文

我在使用以下代码从 C# 创建脱机 OLAP 多维数据集时遇到问题:

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);
        }
    }

我不断收到以下异常:

“多步操作生成错误。检查每个 OLE 数据库状态值。未采取任何操作。”

我从 Excel 生成的 OQY 文件中逐字获取连接字符串。我必须添加“Mode=Write”部分,否则我会收到另一个异常(“文件可能正在使用”)。

连接字符串有什么问题?如何诊断错误?有人请指导我...

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...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

梦初启 2024-08-19 14:48:02

最近,我发现了这个由三部分组成的教程,我希望这对您有帮助

http ://netpl.blogspot.com/2007/11/complete-olap-infrastruct-without.html

Recently, I found this three parts tutorial, I hope this help you

http://netpl.blogspot.com/2007/11/complete-olap-infrastructure-without.html

擦肩而过的背影 2024-08-19 14:48:02

这次微软支持为我找到了一个可行的解决方案!它非常简单 - 连接字符串的最后部分应如下所示:

Source_DSN=dbfodbc32; Mode=ReadWrite; UseExistingFile=False

最关键的部分是“Mode=ReadWrite; UseExistingFile=False”。

经过此修改后,立方体已正确创建。希望这有帮助。

This time Microsoft Support found a workung solution for me! It is very simple - the last part of the connection string should look like this:

"Source_DSN=dbfodbc32; Mode=ReadWrite; UseExistingFile=False"

The most critical part is "Mode=ReadWrite; UseExistingFile=False".

After this modification cube was created properly. Hope this helps.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文