Try this one fro inserting blob. This works perfectly for me! (just a crude example)
Normal
0
false
false
false
EN-US
X-NONE
X-NONE
MicrosoftInternetExplorer4
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0in 5.4pt 0in 5.4pt;
mso-para-margin:0in;
mso-para-margin-bottom:.0001pt;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-fareast-font-family:"Times New Roman";
mso-fareast-theme-font:minor-fareast;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;
mso-bidi-font-family:"Times New Roman";
mso-bidi-theme-font:minor-bidi;}
//---------------------------------------------------------------------------------
public void
InsertImage() // got from a previous thread
{
using (SQLiteTransaction
mytransaction = connection.BeginTransaction())
{
SQLiteCommand mycommand = new SQLiteCommand(connection);
SQLiteParameter myparam = new SQLiteParameter("@myparam");
SQLiteParameter myparam2 = new SQLiteParameter("@myparam2");
mycommand.CommandText = "INSERT INTO
memberimage VALUES(@myparam, @myparam2)";
mycommand.Parameters.Add(myparam);
// <- myparam1 is int
mycommand.Parameters.Add(myparam2); // <- in myparam2 I save the blob image
MemoryStream ms = new MemoryStream();
myparam.Value = 1;
pictureBox1.Image.Save(ms, pictureBox1.Image.RawFormat);
myparam2.Value =
ms.ToArray();
// <- here I save the image
mycommand.ExecuteNonQuery();
mytransaction.Commit();
}
}
//---------------------------------------------------------------------------------
private void
GetImage()
{
SQLiteDataAdapter DB;
DataSet DS = new
DataSet();
string CommandText = "SELECT
memberId, memberImage from memberimage where memberId = 1";
DB = new SQLiteDataAdapter(CommandText,
connection);
DS.Reset();
DB.Fill(DS);
DataRowCollection dataRowCol =
DS.Tables[0].Rows;
MemoryStream ms = null;
foreach (DataRow
dr in dataRowCol)
{
int id = Convert.ToInt32(dr["memberId"]);
byte[ data = (byte[)dr["memberImage"];
ms = new MemoryStream(data);
}
pictureBox2.Image = Image.FromStream(ms);
}