I have an uploadfile using a c#.net that stores the image to a sql database type Image. i'm using
vb.net to retrieve the image and display it. but when i use response.binarywrite it only displays System.byte[]
Here is my upload code using c#.net (this was an open source code i retrieved and not my own. I made modifications so i assume i did something wrong since i primarily use
vb.net)
Stream imgStream = uploadFile.InputStream;
int imgLen = uploadFile.ContentLength;
string imgContentType = uploadFile.ContentType;
byte[] imgBinaryData = new byte[imgLen];
int n = imgStream.Read(imgBinaryData,0,imgLen);
SqlConnection sqlConn = new SqlConnection("Server=localserver;Database=Photos; Uid=blank;Pwd=blank;");
sqlConn.Open();
SqlCommand sqlComm = new SqlCommand("sp_Photos_InsertPhoto '" + UserID + "','" + Album + "','" + imgBinaryData + "'", sqlConn);
sqlComm.ExecuteReader();
sqlConn.Close();
Here is my retrieval code using
vb.net:
Dim oCN
Dim oRS
oCN = Server.CreateObject("ADODB.Connection")
oRS = Server.CreateObject("ADODB.Recordset")
oCN.Open(Session("Connection"), Session("SQLUser"), Session("SQLPassword"))
oRS = oCN.Execute("Select Photo from tblAlbums")
Response.BinaryWrite(oRS("Photo").value)
oCN.Close()
again the Response.BinaryWrite(oRS("Photo").value) yields System.Byte[] and not the picture.