我正在尝试修改 RDL 文件中的 connectionString,该文件由 xml 节点动态组成。但是我只能使用/
我无法检索任何其他节点来检索根,例如,当我尝试检索它作为空的 connectString 时。
XmlDocument xml = new XmlDocument();
xml.Load(selectedFiles[0].ToString());
var connectionString = xml.SelectSingleNode("/");
RDL 文件的 xml:
<?xml version="1.0" encoding="utf-8"?>
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSource1">
<ConnectionProperties>
<DataProvider>SQL</DataProvider>
<ConnectString>Data Source=gbr-t-sql-001;Initial Catalog=Neptune2Dev</ConnectString>
<IntegratedSecurity>true</IntegratedSecurity>
</ConnectionProperties>
<rd:SecurityType>Integrated</rd:SecurityType>
<rd:DataSourceID>70fcaa8f-d76a-4919-a53c-ba313ca99926</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSource1</DataSourceName>
<QueryParameters>
<QueryParameter Name="@profileID">
<Value>=Parameters!profileID.Value</Value>
</QueryParameter>
</QueryParameters>
<CommandType>StoredProcedure</CommandType>
<CommandText>Report_BylineSummary</CommandText>