I have the following C# Code:
MySqlDataReader myData;
MySqlCommand cmd = new MySqlCommand();
string SQL;
SQL = "SELECT * FROM StoredFile WHERE StoredFileID = [PRIMARY_KEY] LIMIT 1";
cmd.Connection = new MySqlConnection(DbContext.Database.Connection.ConnectionString);
cmd.Connection.Open();
cmd.CommandText = SQL;
myData = cmd.ExecuteReader();
if (!myData.HasRows)
return null;
myData.Read();
StoredFile rtn = new StoredFile();
rtn.StoredFileID = (long)myData["StoredFileID"];
rtn.Filename = (string)myData["Filename"];
rtn.MIMEType = (string)myData["MIMEType"];
rtn.Data = (byte[])myData["Data"];
rtn.SYS_INS_USER = (string)myData["SYS_INS_USER"];
rtn.SYS_INS_ID = (long)myData["SYS_INS_ID"];
rtn.SYS_INS_DT = (DateTime)myData["SYS_INS_DT"];
rtn.SYS_UPD_USER = (string)myData["SYS_INS_USER"];
rtn.SYS_UPD_ID = (long?)myData["SYS_INS_ID"];
rtn.SYS_UPD_DT = (DateTime?)myData["SYS_INS_DT"];
rtn.SYS_ACTIVE = (bool)myData["SYS_ACTIVE"];
var o = myData["PrivateNotes"];
if (o != DBNull.Value)
rtn.PrivateNotes = (string)o;
myData.Close();
myData.Dispose();
cmd.Connection.Close();
cmd.Dispose();
return rtn;
Using C#, when I use "5" for the [PRIMARY_KEY], MySQL returns the record. When I use "10" for the [PRIMARY_KEY], MySQL doesn't return a record
Using phpMyAdmin, the select statement returns both records. Also in phpMyAdmin I can download the blob data and all is fine with it.
Records from phpMyAdmin:
It seems like anything over a few KB's are not returned when trying it through C#. Is there a setting or something in C# / MySQL Library / etc that prevents the select from returning a "large" BLOB field?