我有C#程序生成RDL文件用于报告服务中的whitch Show报告.我使用Linq到Xml来生成Xml.
当我尝试将xmlns XAttribute 添加到Report Element时,我遇到了几个问题.
我测试以下方法:
第一:
XDocument d = new XDocument(
new XDeclaration("1.0", "utf-8", "yes"),
new XElement("Report",
new XAttribute(XNamespace.Xmlns + "rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"),
new XAttribute(XNamespace.Xmlns + "cl", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition"),
new XAttribute("xmlns", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition"),
new XElement("DataSources", ""),
new XElement("DataSets", ""),
new XElement("ReportSections",
Run Code Online (Sandbox Code Playgroud)
这是我的代码中的一部分,显示如何生成xml:
第二:
XNamespace reportDef = "http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition";
XDocument d = new XDocument(
new XDeclaration("1.0", "utf-8", "yes"),
new XElement(reportDef + "Report",
new XAttribute(XNamespace.Xmlns + "rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"),
new XAttribute(XNamespace.Xmlns + "cl", "http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition"),
new XElement("DataSources", ""),
new XElement("DataSets", ""),
new XElement("ReportSections",...
Run Code Online (Sandbox Code Playgroud)
第一种方法返回Error,第二种方法将属性xmlns …
我有c#程序,这从输入获取Sql查询并执行此操作.有时,This Query包含执行查询后的任何单词,返回"Divide By Zero Exception".
我想在执行查询之前禁用SqlException 并检查其他输入的单词然后启用它.