使用VBA SQL的共享点列表访问

时间:2018-09-04 09:16:10

标签: sql vba sharepoint adodb

我正在研究必须从共享点列表中获取数据的项目。我能够创建连接并使用ADODB连接打开连接,但不确定如何在选择查询中使用列表名称。我的代码如下:

sub DatafromSp

Dim ExcelConnection As ADODB.Connection         
Dim FileFullPath, SearchString As String        
Dim NewRecordSet As Recordset                  

Set ExcelConnection = New ADODB.Connection      

ExcelConnection.ConnectionString = _
"Provider=Microsoft.ACE.OLEDB.12.0;WSS;IMEX=2;RetrieveIds=Yes;DATABASE=http://********/Data_Extract.aspx;LIST={D07C18D2-A240-4617-883F-3AEFD8313D60};"

ExcelConnection.Open             'Opening the new connection and working fine

    Set NewRecordSet = New ADODB.Recordset
    Set NewRecordSet = ExcelConnection.Execute("Select count(*) from D07C18D2-A240-4617-883F-3AEFD8313D60")   'facing error on this line

end sub

任何人都可以建议我如何在sql查询中使用列表名称?

0 个答案:

没有答案