can any one explain me how to retrieve the binary data from a table
resumearray = ((
i used like this.
in declaration i declare like this
byte[] resumearray;
but the error use of unassigned local variable error will occur.how can i solve this
byte[])rdr["resume"]);
Raju AddadaPosted Mar 28, 2011, 8:13 AM
You try this it may work...
This is for Retrieving the data from data base which is stored using Image datatype.
Byte[] blob = null;
FileStream fs = null;
SqlCommand cmd = new SqlCommand("SP_GETImages", con);
con.Open();
SqlDataReader objDr = cmd.ExecuteReader();
blob = new Byte[(objDr.GetBytes(5, 0, null, 0, int.MaxValue))];
objDr.GetBytes(0, 0, blob, 0, blob.Length);
fs = new FileStream(Server.MapPath("Images/" + ImgDesc + Idk + ".jpg"), FileMode.Create, FileAccess.Write);
fs.Write(blob, 0, blob.Length);
fs.Close();
objDr.Close();
con.Close();
Krishna GaradPosted Mar 28, 2011, 8:04 AM
byte[] resumarray=null;
resumearray=(byte[])rdr["resume"];
it will work.