
02/02/2012, 20:07
|
| | Fecha de Ingreso: febrero-2012
Mensajes: 1
Antigüedad: 13 años Puntos: 0 | |
Respuesta: Guardar Imagen Sql desde C# LEO..!!!!
yo necesito esa ayuda de favor....
ya guarde imagenes en sql y al momento de leerlas en .net y asignarla a la imagen me marca un error que:: El parámetro no es válido.
te dejo mi codigo haber si me puedes ayudar, gracias
SqlConnection cnn = new SqlConnection("Data Source=(local);Initial Catalog=CGV;");
cnn.Open();
SqlCommand cmd = new SqlCommand("select imgfile from myimages");
DataSet ds = new DataSet();
SqlDataAdapter da = new SqlDataAdapter("select imgfile from myimages", cnn);
da.Fill(ds, "myimages");
if (ds.Tables["myimages"].Rows.Count != 0)
{
byte[] imageBuffer = (byte[])ds.Tables["myimages"].Rows[0]["imgfile"];
MemoryStream ms = new MemoryStream(imageBuffer);
pictureBox1.Image = Image.FromStream(ms);
} |