سلام
من در این مورد search کردم و به نتایج خوبی هم رسیدم کدی که براتون می زارم تو خیلی جاها مثل همین رو گذاشتن ولی نمی دونم چرا برا من error می ده .اگه ممکنه راهنماییم کنین
MemoryStream stream = newMemoryStream();
conn = newSqlConnection(constr);
string ct = "SELECT photo FROM student where (" +
"نام=@نام and نام_خانوادگی=@نام_خانوادگی" +
")";
SqlCommand command = new
SqlCommand(ct, conn);
command.Parameters.Add("@نام", SqlDbType.NVarChar, 50).Value = comboBox1.SelectedValue.ToString();
command.Parameters.Add("@نام_خانوادگی", SqlDbType.NVarChar, 50).Value = comboBox2.SelectedValue.ToString();
try
{
conn.Open();
byte[] image = (byte[])command.ExecuteScalar();
stream.Write(image, 0, image.Length);
Bitmap bitmap = newBitmap(stream);
//Response.ContentType = "image/gif";
//bitmap.Save(Response.OutputStream, ImageFormat.Gif);
pictureBox1.Image = bitmap;
}
finally
{
conn.Close();
stream.Close();
}
تو خط bitmap =new bitmap(stream )
error می ده که Parameter is not valid.
باید چه کار کنم؟