I am trying to get the data from the Sybase
database. But when I try to dispose
or close
the connection it throws the exception SQL Runtime Error ...???
. No inner exception, no other details. Here is the code I am trying
try
{
List<Dataclass> lstDataclass = new List<Dataclass>();
using (IDataReader reader = this.ExecuteReader(CommandType.StoredProcedure, Constants.ProcedureName, lstSQLParameter))
{
if (reader != null)
{
while (reader.Read())
{
lstDataclass.Add(ReadData(reader) as Dataclass);
}
}
}//Here is exception is thrown
return lstDataclass ;
}
catch (Exception ex)
{
Logging.CDSLogger.LogEntry(MethodBase.GetCurrentMethod(), ex.Message, TraceEventType.Error);
throw;
}
This code throws the exception as mentioned above the stacktrace for this is as,
at iAnywhere.Data.SQLAnywhere.SAInternalConnection.CheckException(Int32 idEx, Boolean freeConn)
at iAnywhere.Data.SQLAnywhere.SAInternalConnection.ReturnToPool()
at iAnywhere.Data.SQLAnywhere.SAConnectionPool.ReturnConnection(SAInternalConnection connection)
at iAnywhere.Data.SQLAnywhere.SAConnectionPoolManager.ReturnConnection(SAInternalConnection connection)
at iAnywhere.Data.SQLAnywhere.SAConnection.Dispose(Boolean disposing)
at iAnywhere.Data.SQLAnywhere.SAConnection.Close()
at iAnywhere.Data.SQLAnywhere.SADataReader.myDispose(Boolean disposing)
at iAnywhere.Data.SQLAnywhere.SADataReader.myDispose()
at iAnywhere.Data.SQLAnywhere.SADataReader.Close()
at BusinessLayer.BusinessCheckRegisterTable.GetAllDataForNacha(EntityEDIScreenRemittanceExport entityScreenRE) in
And if I remove the using
then it runs fine. Even If I try to to Close()
the connection the same exception is thrown.This only happens for sybase not any other database.
Any help would be great. If anything confusing or not understandable please feel free to comment.