I have a mysql table with a Medium Blob field that I filled with PDFs.
The PDFs are stored in the field without issue, and are inserted using the following query:
INSERT INTO PDFHistory ( OrderId, PDFByteArray) VALUES ( 123456, Convert.ToBase64String(pdf.ByteArray))
I am unable to pull the record and populate a byte[] object. I get the error "The input is not a valid Base-64 string as it contains a non-base 64 character, more than two padding characters, or an illegal character among the padding characters."
dbManager.Open();
using (DataTable dt = dbManager.ExecuteDataTable(CommandType.Text, "SELECT * FROM PDFHistory WHERE OrderId = {0} ORDER BY Timestamp DESC LIMIT 1" ))
{
if (dt.Rows.Count > 0)
{
byte[] PDFByteArray = Convert.FromBase64String(dt.Rows[0]["PDFByteArray"].ToString());
}
}
Any insight is appreciated.
Edit:
The mysql blob record looks like this (in general)
JVBERi0xLjQKJ.....too much to post.....AAAAAAAAAA==