http://www.csdn.net/Develop/read_article.asp?id=16437

解决方案 »

  1.   

    Microsoft .NET Framework Data Provider for Oracle Reference Documentation  
    Creating and Retrieving a BFILE
    The following C# example demonstrates how you can create a BFILE in an Oracle table, and then retrieve it in the form of an OracleBFile object. The example demonstrates the use of the OracleDataReader object and the OracleBFile Seek and Read methods.using System;
    using System.IO;
    using System.Data;
    using System.Data.OracleClient;public class Sample
    {
       public static void Main(string[] args)
       {
          OracleConnection myConnection = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes");
          myConnection.Open();      OracleCommand myCommand = myConnection.CreateCommand();
          myCommand.CommandText = "CREATE or REPLACE DIRECTORY MyDir as 'c:\\bfiles'";
          myCommand.ExecuteNonQuery();
          myCommand.CommandText = "CREATE TABLE MyTable(col1 number, col2 BFILE)";
          myCommand.ExecuteNonQuery();
          myCommand.CommandText = "INSERT INTO MyTable values ('2', BFILENAME('MYDIR', 'MyFile.jpg'))";
          myCommand.ExecuteNonQuery();
          myCommand.CommandText = "SELECT * FROM MyTable";        byte[]              buffer = new byte[100];      OracleDataReader myReader = myCommand.ExecuteReader();
          using (myReader) {
              if (myReader.Read()) {
                    OracleBFile myBFile = myReader.GetOracleBFile(1);
                    using (myBFile) {
                      myBFile.Seek(0, SeekOrigin.Begin);
                      myBFile.Read(buffer, 0, 100);
                  }
              }
          }      myConnection.Close();
       }}
      

  2.   

    OracleConnection myConnection = new OracleConnection("Data Source=Oracle8i;Integrated Security=yes");
          myConnection.Open();myConnection.Close();
    出现上面的错误是在myConnection.Close();提示的
      

  3.   

    到oracle 网站下在Oracle Release 2 Data Provider for .NET http://otn.oracle.com/software/content.html