Value Property (OracleLob)
'Declaration
Public ReadOnly Property Value As Object
Property Value
For
OracleDbType.Blob and
OracleDbType.BFile, an array of type Byte[]. For
OracleDbType.Clob and
OracleDbType.NClob, a string. For null data,
Null.
This code fragment downloads a LOB field from a table to a file.
Value property is initialized by calling
GetOracleLob method and then written to a stream.
OracleLob myLob = myReader.GetOracleLob(myReader.GetOrdinal("Picture"));
if(!myLob.IsNull)
{
string FN = myReader.GetString(myReader.GetOrdinal("PicName"));
FileStream fs = new FileStream("D:\\Tmp\\"+FN+".bmp", FileMode.Create);
fs.Write(myLob.Value,0,(int)myLob.Length);
fs.Close();
Console.WriteLine(FN+" downloaded.");
}
Dim myLob As OracleLob = myReader.GetOracleLob(myReader.GetOrdinal("Picture"))
If Not myLob.IsNull Then
Dim FN As String = myReader.GetString(myReader.GetOrdinal("PicName"))
Dim fs As FileStream = New FileStream("D:\Tmp\" + FN + ".bmp", FileMode.Create)
fs.Write(myLob.Value, 0, Convert.ToInt32(myLob.Length))
fs.Close()
Console.WriteLine(String.Concat(FN, " downloaded."))
End If
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2