Reports are usually bound to data at design time, but you can also supply the data entirely from code.

Registering data. Load the report template, clear any design-time connections, and register your own data source under a name that matches the data references in the template:
private void ShowReport(DataSet dataSet)
{
    var report = new StiReport();
    report.Load(@"Reports\TwoSimpleLists.mrt");
    report.Dictionary.Databases.Clear();
    report.RegData("Demo", dataSet);
    report.Show();
}

The data itself can come from anywhere — here it is read from an XML file and its schema:
var dataSet = new DataSet();
dataSet.ReadXmlSchema(@"Data\Demo.xsd");
dataSet.ReadXml(@"Data\Demo.xml");
ShowReport(dataSet);

RegData makes the object available to the report engine; Dictionary.Databases.Clear() removes the connections stored in the template so that only your run-time data is used.

Используя этот сайт, вы соглашаетесь на использование файлов Cookie для аналитики и персонализированного контента. Файлы Cookie хранят полезную информацию на вашем компьютере, чтобы помочь нам повысить эффективность и удобство использования. Для получения дополнительной информации, пожалуйста, прочтите Конфиденциальность и Использование Cookie.