如何在C#中创建离线OLAP立方体?
我在使用以下代码从 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
最近,我发现了这个由三部分组成的教程,我希望这对您有帮助
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
这次微软支持为我找到了一个可行的解决方案!它非常简单 - 连接字符串的最后部分应如下所示:
“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.