Hi,
It is possbile to get de SQL statement at runtime?
thanks!!
yes, it is possible!!
here the code:
var ns = "{http://schemas.infragistics.com/xaml/reports}"; var document = XDocument.Load(path_igr); var reportDataSources = document.Descendants(ns + "SqlDataSource").Select(ds => new { Name = ds.Attributes("Name").First().Value, ConnectionStringKey = ds.Attributes("ConnectionName").First().Value, QueryText = ds.Descendants(ns + "Query").Attributes("CommandText").First().Value, Fields = ds.Descendants(ns + "SqlDataSource.Fields").Elements().Select(field => new { DataField = field.Attribute("DataField").Value, Name = field.Attribute("Name").Value, FieldTypeString = field.Attribute("FieldTypeString").Value }), Parameters = ds.Descendants(ns + "SqlDataSource.Parameters").Elements().Select(field => field.Attribute("Name").Value) }); foreach (var dataSource in reportDataSources) { MessageBox.Show(dataSource.QueryText, "SQL", MessageBoxButtons.OK, MessageBoxIcon.Information); }
Thanks!!