/無法讀出SQL圖片檔,都會顯示參數無效,可是我看參數名都打對了,可是就是錯誤,另外我看我讀出來的byte[] data變數,多了很多索引,但是每一個索引的值都是0...麻煩各位大大幫我看一下,要讀出SQL(varbinary(MAX))欄位的二進位圖片,並且秀到Picturebox上!!/
unboxingTableAdapter2.Fill(mMdatabaseDataSet1.Unboxing);
SqlConnection conn = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=MMdatabase;Integrated Security=True");
string strSQL = "select Photo1 from unboxing where ArticleID=@ArticleID";
SqlCommand cmd = new SqlCommand(strSQL, conn);
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@ArticleID", textBox2.Text);
conn.Open();
byte[] data = (byte[])cmd.ExecuteScalar(); //data每一個索引值都是0
MemoryStream ms = new MemoryStream(data); //讀到這行顯示參數錯誤!!
Bitmap bmp = new Bitmap(ms);
pictureBox1.Image = bmp;
ms.Dispose();
ms.Close();
conn.Dispose();
conn.Close();