Image.FromStream() method returns Invalid Argument exception

前端 未结 10 2427
臣服心动
臣服心动 2020-11-29 09:18

I am capturing images from a smart camera imager and receiving the byte array from the camera through socket programming (.NET application is the client, camera is the serve

10条回答
  •  有刺的猬
    2020-11-29 09:59

    this code is working

            string query="SELECT * from gym_member where Registration_No ='" + textBox9.Text + "'";
    
            command = new SqlCommand(query,con);
            ad = new SqlDataAdapter(command);
            DataTable dt = new DataTable();
            ad.Fill(dt);
            textBox1.Text = dt.Rows[0][1].ToString();
            textBox2.Text = dt.Rows[0][2].ToString();
            byte[] img = (byte[])dt.Rows[0][18];
            MemoryStream ms = new MemoryStream(img);
    
            pictureBox1.Image = Image.FromStream(ms);
            ms.Dispose();
    

提交回复
热议问题