Jag är inte säker på vad lretorno.Load(...) gör för att läsa datat, men detta pseudo-kodsexempel med en SELECT-sats kan peka dig i rätt riktning. Historiskt har jag alltid behövt hämta blobben uttryckligen och läsa ut den för att få bytena.
Exempel för att hämta en LONG RAW-datatype
var imgCmd = new OracleCommand("SELECT photo FROM photos WHERE photo_id = 1", _con); imgCmd.InitialLONGFetchSize = -1; // Retrieve the entire image during select instead of possible two round trips to DB var reader = imgCmd.ExecuteReader(); if (reader.Read()) { // Fetch the LONG RAW OracleBinary imgBinary = reader.GetOracleBinary(0); // Get the bytes from the binary obj byte[] imgBytes = imgBinary.IsNull ? null : imgBinary.Value; } reader.Close(); Exempel för att hämta en BLOB-datatype
var imgCmd = new OracleCommand("SELECT photo FROM photos WHERE photo_id = 1", _con); var reader = imgCmd.ExecuteReader(); if (reader.Read()) { // Fetch the blob OracleBlob imgBlob = reader.GetOracleBlob(0); // Create byte array to read the blob into byte[] imgBytes = new byte[imgBlob.Length]; // Read the blob into the byte array imgBlob.Read(imgBytes, 0, imgBlob.Length); } reader.Close(); I fallet LONG RAW är det att sätta InitialLONGFetchSize = -1 som tvingar fram hela bilden i en resa, vilket undviker det förvalda chunkade beteendet med flera rundturer.