System.AccessViolationException
609701Nov 21 2007 — edited Feb 18 2008I am using Oracle 10g and ODAC 2.102.2.20 provider for .NET 2.0
I have a simple procedure written in VS2005
public DataRow GetReport(int reportId, string type)
{
OracleConnection _conn = new OracleConnection(ConnectionString);
OracleCommand _cmd = new OracleCommand();
cmd.Connection = conn;
_cmd.CommandText = @"SELECT TRANS, HEAD FROM ELP.REPORT
WHERE ID_REPORT = :ID_REPORT AND
REP_TYPE = :REP_TYPE";
OracleParameter _param = new OracleParameter(":ID_REPORT", OracleDbType.Int32);
_param.Value = reportId;
_cmd.Parameters.Add(_param);
_param = new OracleParameter(":REP_TYPE", OracleDbType.Varchar2, 4);
_param.Value = type;
_cmd.Parameters.Add(_param);
OracleDataAdapter _da = new OracleDataAdapter();
_da.SelectCommand = _cmd;
DataTable _dt = new DataTable();
_da.Fill(_dt);
if (_dt.Rows.Count > 0)
return _dt.Rows[0];
else
throw new NotSupportedException("Don' find report " + type + ": " + reportId.ToString());
}
I execute this procedure about 10.000 time a day and from time to time (cca 2-5 times/day) receive an error:
System.AccessViolationException
Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Oracle.DataAccess.Client.OpsSql.Prepare2(IntPtr opsConCtx, IntPtr& opsErrCtx, IntPtr& opsSqlCtx, IntPtr& opsDacCtx, OpoSqlValCtx*& pOpoSqlValCtx, String pCommandText, IntPtr& pUTF8CommandText, OpoMetValCtx*& pOpoMetValCtx, Int32 prmCnt) at Oracle.DataAccess.Client.OracleCommand.ExecuteReader(Boolean requery, Boolean fillRequest, CommandBehavior behavior) at Oracle.DataAccess.Client.OracleDataAdapter.Fill(DataTable[] dataTables, Int32 startRecord, Int32 maxRecords, IDbCommand command, CommandBehavior behavior) at System.Data.Common.DbDataAdapter.Fill(DataTable dataTable) at EOddaja.DmReports.GetReport(Int32 reportId, String type) at EOddaja.MsgManipulator.GetReportData(Int32 reportId, String type) at EOddaja.MsgSender.ThreadProcessor(Object o)
Any suggestions?
THX