5 pts.
 Using the BLOB datatype
IT HAS BEEN CLEARED THAT TO INSERT THE IMAGES INTO ORACLE DATABASE, A COLUMN WITH DATATYPE BLOB HAS TO BE CREATED IN THE TABLE, PLEASE TELL ME HOW TO INSERT AND RETRIEVE THE IMAGE INTO AND FROM THE DATABASE RESPECTIVELY. THANKS, SIMRAN.

Software/Hardware used:
ASKED: August 22, 2008  5:01 AM
UPDATED: August 25, 2008  6:53 PM

Answer Wiki:
SIMRAN, The only time I have to write Binary objects to the db is through an application and not via SQL. I have a web application that allows users to enter in pictures (of themselves which can be very funny to review). The developers retrieve and write to it using a method that does this: public byte[] GetPhoto(string userId) { byte[] photo = null; StringBuilder sbSql = new StringBuilder(); sbSql.Append("SELECT PHOTOS.PHOTO, users.id"); sbSql.Append("FROM PHOTOS INNER JOIN "); sbSql.Append(" users ON PHOTOS.ID = users.ID "); sbSql.Append(" WHERE (users.ID = @:id) "); DbCommand cmd = GetSqlStringCommand(sbSql.ToString()); AddInParameter(cmd, "id", DbType.String, userId); using (IDataReader idr = ExecuteReader(cmd)) { while (idr.Read()) { photo = (byte[])idr["PHOTO">; } } return photo; } Hope this helps. rdano
Last Wiki Answer Submitted:  August 25, 2008  6:53 pm  by  Rdano   175 pts.
All Answer Wiki Contributors:  Rdano   175 pts.
To see all answers submitted to the Answer Wiki: View Answer History.


Discuss This Question:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _