0
我有一個Excel document-level customisation(VSTO,C# - 但不是加載項),用戶可以從SQL Server數據庫動態檢索數據。現在我將結果放在工作表上,但可能會有超過一百萬行。 有誰知道是否有可能將數據加載到Power Pivot數據模型中?在VSTO Excel應用程序中加載Power Pivot數據模型
我有一個Excel document-level customisation(VSTO,C# - 但不是加載項),用戶可以從SQL Server數據庫動態檢索數據。現在我將結果放在工作表上,但可能會有超過一百萬行。 有誰知道是否有可能將數據加載到Power Pivot數據模型中?在VSTO Excel應用程序中加載Power Pivot數據模型
這裏是關於Dany Hoter關於VBA的blogged。在C#中應該是一個很好的模式:
Sub AddSQLtables()
‘One or more tables from a SQL server database
‘Relationships are detected if they are declared in the database
ActiveWorkbook.Connections.Add2 _
「Connection Name」, 「」, _
「OLEDB;Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Data Source=<SQL server – name>;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Use Encryption for Data=False;Tag with column collation when possible=False;Initial Catalog=AdventureWorksDW2008R2」 _
, 「」」DimCustomer」」,」」DimGeography」」」, 6, True, True
End Sub
太棒了。不知何故,我預計它會更復雜。 Dany Hoter鏈接也非常有用。謝謝 - 非常感謝。 – COG