Hello. Sorry for the late reply.
Below is the larger portion of the code in my sample test project.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using CoreLab.Data;
using CoreLab.Oracle;
namespace TestProject
{
public partial class Form1 : Form
{
private string tableName = System.Configuration.ConfigurationManager.AppSettings["TableName"];
private string userID = System.Configuration.ConfigurationManager.AppSettings["UserID"];
private string pwd = System.Configuration.ConfigurationManager.AppSettings["Password"];
private string server = System.Configuration.ConfigurationManager.AppSettings["Server"];
private string port = System.Configuration.ConfigurationManager.AppSettings["Port"];
private string Sid = System.Configuration.ConfigurationManager.AppSettings["Sid"];
private string connString = string.Empty;
OracleLob oLob;
OracleDataReader oDtReader;
OracleConnection conn;
OracleCommand command;
public Form1()
{
InitializeComponent();
}
private void btnClick_Click(object sender, EventArgs e)
{
connString = "User Id=" + userID + ";Password=" + pwd + ";Direct=true;Server=" + server + ";port=" + port + ";Sid=" + Sid;
conn = new OracleConnection(connString);
conn.Open();
command = new OracleCommand("SELECT * FROM " + tableName + " WHERE ID = 2094", conn);
oDtReader = command.ExecuteReader();
if (oDtReader.HasRows)
{
oDtReader.Read();
oLob = oDtReader.GetOracleLob(oDtReader.GetOrdinal("FILE_CONTENT"));
oLob.Close(); //<---Exception occurs here
}
oDtReader.Close();
conn.Close();
}
}
}
Fyi, I am using Oracle 10g Client, OraDirect 4.50, VS2005.
The "FILE_CONTENT" is a BLOB type column in my database table.
The value for the ID column does not matter as long as the row contains the blob content in the FILE_CONTENT column.
I faced this problem as well while using VS2008 with the same coding as shown above.
Hope this information may help.
Regards,
Kent