-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
27 lines (24 loc) · 1.13 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data.OleDb;
using System.Data;
using RichEditCustomInsertMergeFieldMenu.Properties;
namespace RichEditCustomInsertMergeFieldMenu {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
richEditControl1.Options.MailMerge.DataSource = GetMailMergeData();
}
private object GetMailMergeData() {
OleDbConnection connection = new OleDbConnection(Settings.Default.nwindConnectionString);
string commandText = @"SELECT Employees.*, Customers.* FROM (Employees INNER JOIN EmployeeCustomers ON Employees.EmployeeID = EmployeeCustomers.EmployeeId) INNER JOIN Customers ON EmployeeCustomers.CustomerId = Customers.CustomerID;";
OleDbCommand selectCommand = new System.Data.OleDb.OleDbCommand(commandText, connection);
OleDbDataAdapter dataAdapter = new OleDbDataAdapter(selectCommand);
DataSet dataSet = new DataSet();
dataAdapter.Fill(dataSet);
return dataSet.Tables[0];
}
}
}