0
您好我想從sql server數據庫檢索圖像使用此代碼和異常生成此錯誤(參數無效)PLZ幫助我,我在表中使用圖像類型沒有一個blob從sql server 2008數據庫檢索圖像使用c#
SqlCommand select = new SqlCommand(vsql, vCon);
try
{
SqlDataAdapter dp = new SqlDataAdapter(select);
DataSet ds = new DataSet("etudiant");
byte[] MisDatos = new byte[0];
dp.Fill(ds,"etudiant");
DataRow myRow = ds.Tables["etudiant"].Rows[0];
MisDatos = (byte[])myRow["image"];
MemoryStream ms = new MemoryStream(MisDatos);
System.Drawing.Image returnImage = System.Drawing.Image.FromStream(ms);
ms.Position = 0;
pictureBox1.Image = Image.FromStream(ms);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
哪個參數? –
跳過dataadapter和數據集並直接用datareader檢索它可能會更好。 –
[鏈接](http://social.msdn.microsoft.com/Forums/getfile/190061)。 – user2430314