This example shows how to fill form data from database.
using var connection = new MySqlConnection("Server=YOURSERVER;User ID=YOURUSERID;Password=YOURPASSWORD;Database=YOURDATABASE");

await connection.OpenAsync();

using var command = new MySqlCommand("SELECT mail, recipient FROM table;", connection);
using var reader = await command.ExecuteReaderAsync();
while (await reader.ReadAsync())
	var mail = reader.GetString("mail");
	var recipient = reader.GetString("recipient");

	label.Text.Expression = $"Hello, {recipient}";

	var pdf = pdfExporter.ExportForm(form);

	var mailMessage = new MailMessage
		From = new MailAddress("This email address is being protected from spambots. You need JavaScript enabled to view it."),
		Subject = "subject",
		Body = "<h1>Hello</h1>",
		IsBodyHtml = true,

	var attachment = new Attachment(new MemoryStream(pdf), MediaTypeNames.Application.Pdf);


By using this website, you agree to the use of cookies for analytics and personalized content. Cookies store useful information on your computer to help us improve efficiency and usability. For more information, please read the privacy policy and cookie policy.