0
private void button2_Click(object sender, EventArgs e)
{
cmd = new SqlCommand("select img from image where title = '1' ", con);
try
{
dr = cmd.ExecuteReader();
while (dr.Read())
{
byte[] img_arr1 = (byte[])dr["img"];
MemoryStream m = new MemoryStream(img_arr1);
image1.Image = Image.FromStream(m);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
오류 :오류 : 매개 변수의 SQL DB에서 이미지를 검색하는 동안 유효하지 않습니다
"Parameter is not valid" while retrieve image from sql DB using Windows Application.
잘못된 이미지를 읽는 중일 수 있습니다. 즉, 잘못 저장된 이미지입니다. [다음을보십시오.] (http://www.codeproject.com/Tips/465950/Why-do-I-get-a-Parameter-is-not-valid-exception-wh) 원래 이미지를 데이터베이스에 저장 했습니까? –
img_arr1에서 얻은 바이트를 확인하십시오 .. !! 또한 DB에 이미지를 저장하는 코드를 보여줍니다. DB에서 이미지로 streamData (byte)를 저장 했습니까? –