I have an employee table in a MySQL database, I have regular columns as full name, date hired, etc. I have also a column which stores binary (blob) data for each employee which I know it’s a pdf file. Now, I want to save each of this binary files into a pdf file on my computer, in C#.
I saw a few forms similar to my scenario, but wasn’t help me.
Here is what I have so far:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace MySqlExport
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
try
{
MySqlCoection coection = DBcoection.GetDBcoection();
string selectString = " select pdfFile, fullName from Employee ";
MySqlCommand selectCommand = new MySqlCommand(selectString, coection);
coection.Open();
MySqlDataReader reader = selectCommand.ExecuteReader();
reader.Read();
// now whats next??.........
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
Thank you everybody for your help.
