日韩久久久精品,亚洲精品久久久久久久久久久,亚洲欧美一区二区三区国产精品 ,一区二区福利

SSAS系列——【08】多維數(shù)據(jù)(程序展現(xiàn)Cube)

系統(tǒng) 2140 0
原文: SSAS系列——【08】多維數(shù)據(jù)(程序展現(xiàn)Cube)

1、引用DLL?

????? 按照之前安裝的MS SQLServer的步驟安裝完成后,發(fā)現(xiàn)在新建的項(xiàng)目中“Add Reference”時(shí)居然找不到Microsoft.AnalysisServices.AdomdClient命名空間,不知道是什么狀況?只好添加DLL了,在“C:\Program Files\Microsoft.NET\ADOMD.NET\100\Microsoft.AnalysisServices.AdomdClient.dll”下找到了該文件,該文件的最后修改時(shí)間是2009年3月30日,534KB。如圖:

dll

圖 AdomdClient.dll的磁盤(pán)路徑

2、連接字符串?

本人覺(jué)得這一塊和ADO.NET沒(méi)有太大的區(qū)別,此處我使用的連接字符串是:Provider=SQLNCLI10.1;Data Source=localhost;Integrated Security=SSPI;Initial Catalog=BPDW; ,該字符串可以在數(shù)據(jù)源設(shè)計(jì)器中找到,所以根本無(wú)需記憶,會(huì)找即可。

ll

圖 連接字符串

3、第一個(gè)程序

?

代碼
        
string ReturnCommandUsingCellSet()
{
// Create a new string builder to store the results
System.
Text .StringBuilder result = new System. Text .StringBuilder();
// Connect to the local server
using (AdomdConnection conn
= new AdomdConnection("Provider = SQLNCLI10. 1 ;Data Source = localhost;Integrated Security = SSPI;Initial Catalog = BPDW;"))
{
conn.
Open ();
// Create a command, using this connection
AdomdCommand cmd
= conn.CreateCommand();
cmd.CommandText
= @" select { [ Measures ] . [ Oil Proved Reserves ] } on columns ,{ [ Dim Time ] . [ 年份 ] . & [ 19 ] } on rows from [ BPDW ] where [ Dim Geography ] . [ 國(guó)家名稱(chēng) ] . & [ Total Asia Pacific ] & [ China ] ";
// Execute the query, returning a cellset
CellSet cs
= cmd.ExecuteCellSet();
// Output the column captions from the first axis
// Note that this procedure assumes a single member exists per column .
result.Append("\t");
TupleCollection tuplesOnColumns
= cs.Axes [ 0 ] . Set .Tuples;
foreach (Microsoft.AnalysisServices.AdomdClient.Tuple
column in tuplesOnColumns)
{
result.Append(
column .Members [ 0 ] .Caption + "\t");
}
result.AppendLine();
// Output the row captions from the second axis and cell data
// Note that this procedure assumes a two - dimensional cellset
TupleCollection tuplesOnRows
= cs.Axes [ 1 ] . Set .Tuples;
for ( int row = 0 ; row < tuplesOnRows. Count ; row ++ )
{
result.Append(tuplesOnRows
[ row ] .Members [ 0 ] .Caption + "\t");
for ( int col = 0 ; col < tuplesOnColumns. Count ; col ++ )
{
result.Append(cs.Cells
[ col, row ] .FormattedValue + "\t");
}
result.AppendLine();
}
conn.
Close ();
return result.ToString();
}
// using connection
}

?

SSAS系列——【08】多維數(shù)據(jù)(程序展現(xiàn)Cube)


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長(zhǎng)非常感激您!手機(jī)微信長(zhǎng)按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫(xiě)作最大的動(dòng)力,如果您喜歡我的文章,感覺(jué)我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長(zhǎng)會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 鞍山市| 长寿区| 贵阳市| 合山市| 土默特右旗| 积石山| 满洲里市| 滨州市| 荔波县| 肇庆市| 合山市| 鸡东县| 新化县| 新竹县| 宁陵县| 闻喜县| 吉安县| 叙永县| 南岸区| 台中市| 灵璧县| 成都市| 桓台县| 交口县| 景泰县| 班玛县| 专栏| 徐汇区| 阜南县| 金昌市| 右玉县| 延边| 沅江市| 林芝县| 桃源县| 孝感市| 丹巴县| 绍兴县| 靖宇县| 靖远县| 抚顺市|