Store the image in the database as the image type:
Httppostedfile Upfile =this.idfile.postedfile; Httppostedfile object, for reading image file properties
int filelength = Upfile.contentlength; Log file length
byte[] Filebytearray = new Byte[filelength]; Image file temporary storage byte array
if (filelength = 0)
{
}
Else
{
Stream streamobject = Upfile.inputstream; Set up a data stream pair like
Read image file data, Filebytearray for data storage, 0 for data pointer position, filelnegth for data length
Streamobject.read (Filebytearray, 0, filelength);
}
is saved in LINQ mode:
V.ry_zp=filebytearray
Read in LINQ:
Zggzdatacontext dc = new Zggzdatacontext ();
var ua = (from V in DC.) Zg_ryxx
where V.pk_code. Contains (request.querystring["Zpid"). ToString (). Trim ())
Select New {ZP = V.ry_zp}). A ();
Response.Clear ();
Response.ContentType = "Image/gif";
Response.BinaryWrite ((byte[]) Ua.ry_zp. ToArray ());
Response.End ();