Skip to content

Commit c5819e8

Browse files
authored
Update Form1.cs
1 parent bbb022e commit c5819e8

File tree

1 file changed

+19
-2
lines changed
  • CS/Reporting-Bind-Report-to-Union-Based-Federated-Data-Source

1 file changed

+19
-2
lines changed

CS/Reporting-Bind-Report-to-Union-Based-Federated-Data-Source/Form1.cs

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,34 @@
11
using System;
22
using System.Windows.Forms;
3+
#region usings_sql
34
using DevExpress.DataAccess.ConnectionParameters;
45
using DevExpress.DataAccess.Sql;
6+
#endregion
7+
#region using_datafederation
58
using DevExpress.DataAccess.DataFederation;
9+
#endregion
10+
#region using_excel
611
using DevExpress.DataAccess.Excel;
712
using System.IO;
13+
#endregion
14+
#region usings_report
815
using System.ComponentModel;
916
using System.Drawing;
1017
using DevExpress.XtraReports.UI;
18+
#endregion
1119

1220
namespace BindReportToFederatedUnionQuery {
1321
public partial class Form1 : Form {
1422
public Form1() {
1523
InitializeComponent();
1624
}
1725
void Button1_Click(object sender, EventArgs e) {
26+
#region ShowDesigner
1827
ReportDesignTool designTool = new ReportDesignTool(CreateReport());
1928
designTool.ShowRibbonDesignerDialog();
29+
#endregion
2030
}
31+
#region CreateFederationDataSource
2132
static FederationDataSource CreateFederationDataSource(SqlDataSource sql, ExcelDataSource excel) {
2233
// Create a federated query's SQL and Excel sources.
2334
Source sqlSource = new Source(sql.Name, sql, "Customers");
@@ -45,6 +56,8 @@ static FederationDataSource CreateFederationDataSource(SqlDataSource sql, ExcelD
4556

4657
return federationDataSource;
4758
}
59+
#endregion
60+
#region CreateReport
4861
public static XtraReport CreateReport() {
4962
// Create a new report.
5063
var report = new XtraReport();
@@ -72,14 +85,17 @@ public static XtraReport CreateReport() {
7285

7386
return report;
7487
}
88+
#endregion
89+
#region CreateSqlDataSource
7590
static SqlDataSource CreateSqlDataSource() {
76-
var connectionParameters = new Access97ConnectionParameters(Path.Combine(Path.GetDirectoryName(typeof(Form1).Assembly.Location), "Data/nwind.mdb"), "", "");
77-
var sqlDataSource = new SqlDataSource(connectionParameters) { Name = "Sql_Customers" };
91+
var connectionParameters = new SQLiteConnectionParameters("Data/nwind.db", null); var sqlDataSource = new SqlDataSource(connectionParameters) { Name = "Sql_Customers" };
7892
var categoriesQuery = SelectQueryFluentBuilder.AddTable("Customers").SelectAllColumnsFromTable().Build("Customers");
7993
sqlDataSource.Queries.Add(categoriesQuery);
8094
sqlDataSource.RebuildResultSchema();
8195
return sqlDataSource;
8296
}
97+
#endregion
98+
#region CreateExcelDataSource
8399
static ExcelDataSource CreateExcelDataSource() {
84100
var excelDataSource = new ExcelDataSource() { Name = "Excel_Suppliers" };
85101
excelDataSource.FileName = Path.Combine(Path.GetDirectoryName(typeof(Form1).Assembly.Location), "Data/Suppliers.xlsx");
@@ -89,5 +105,6 @@ static ExcelDataSource CreateExcelDataSource() {
89105
excelDataSource.RebuildResultSchema();
90106
return excelDataSource;
91107
}
108+
#endregion
92109
}
93110
}

0 commit comments

Comments
 (0)