0
我剛剛將位圖縮略圖轉換爲二進制代碼以存儲到我的MS Access數據庫中。我現在試圖將該二進制數據轉換回圖像格式存儲到我的Imagelist中。我現在的代碼是。將二進制從ms訪問轉換爲Imagelist的圖像
private void Form1_Load(object sender, EventArgs e)
{
vcon.Open();
string get = "Select Path, Images FROM IMGSTR";
OleDbCommand cmdget = new OleDbCommand(get, vcon);
OleDbDataReader reader;
reader = cmdget.ExecuteReader();
while (reader.Read())
{
string path = reader["Path"].ToString();
// should I convert binary into a string?
string thumbnail = reader["Images"].ToString();
// How to convert the binary data from the
// MS database back to a bitmap image.
//I need to convert the binary back to bitmap to work
//in this imagelist.
this.imageList1.Images.Add(thumbnail);
}
}
如果有人可以幫助我,將是巨大的。謝謝!