## I have added error codes at the end of the question, hope it might help you to help me.
Hi! there IT nerds, this old man needs some help big time.
I have an application that is suppose to search incidents and if needed export those search results to excel sheet. Searching part is fine. But while exporting, it will only export certain amount of data (seems like there is some kind of limitation). For example - if I want to search and export for 20 days worth of incident it will do just fine. If I search for 25 days, it will search fine but while exporting it will throw an exception. Is it because it is trying to export in the same way it is searching? I don't have much knowledge about asp.net and c#. These codes were written 10 years ago by some contractors. I don't know when the issue started as I just took over the application. Any feedback, comments, help will be highly appreciated. Below are the codes that being used:
public partial class IncidentReviewLogExport : System.Web.UI.Page
{
#region Events
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string REVN_SEQList = string.Empty;
DataSet ObjDataSet = new DataSet();
WEIS.SearchIncidents ObjSearchIncidents = new WEIS.SearchIncidents();
DataTable ObjDataTable = WEIS.SessionManager.Current.IncidentsDataTable;
if (ObjDataTable == null)
{
#region Load details
ObjDataSet = ObjSearchIncidents.GetIncidents(Convert.ToInt32(WEIS.SessionManager.Current.Selected_Mill_ID.ToString()),
Request.QueryString["StartDate"].ToString(), Request.QueryString["EndDate"].ToString(), Request.QueryString["AllMills"].ToString(), Request.QueryString["EiscSeqs"].ToString(),
Convert.ToInt32(Request.QueryString["Area"].ToString().Trim().Length == 0 ? "0" : Request.QueryString["Area"].ToString()),
Request.QueryString["Status"].ToString().Trim().Length == 0 ? "0" : Request.QueryString["Status"].ToString(),
Convert.ToInt32(Request.QueryString["EventType"].ToString().Trim().Length == 0 ? "0" : Request.QueryString["EventType"].ToString()),
Convert.ToInt32(Request.QueryString["Instrument"].ToString().Trim().Length == 0 ? "0" : Request.QueryString["Instrument"].ToString()),
Request.QueryString["EventGroupDisplayFlag"].ToString().Trim().Length == 0 ? "" : Request.QueryString["EventGroupDisplayFlag"].ToString());
#endregion
ObjDataTable = ObjDataSet.Tables[0];
}
if (ObjDataTable.Rows.Count > 0)
{
foreach (DataRow objDataRow in ObjDataTable.Rows)
{
REVN_SEQList = REVN_SEQList + objDataRow["REVN_SEQ"].ToString() + ",";
}
REVN_SEQList = REVN_SEQList.Remove(REVN_SEQList.Length - 1);
ObjDataSet = new DataSet();
ObjDataSet = ObjSearchIncidents.GetIncidentsForExport(REVN_SEQList);
Response.Clear();
Response.Buffer = true;
Response.Charset = "";
Response.ContentType = "application/vnd.ms-excel";
StringWriter stringWrite = new StringWriter();
HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
GrdViewIncidents.AllowPaging = false;
GrdViewIncidents.AllowSorting = false;
GrdViewIncidents.DataSource = ObjDataSet.Tables[0];
GrdViewIncidents.DataBind();
GrdViewIncidents.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
else
{
Response.Write("There were no incidents found.");
}
}
}
public override void VerifyRenderingInServerForm(Control control)
{
}
#endregion
}
//==============================================================
#region GetIncidentsForExport
public DataSet GetIncidentsForExport(string REVN_SEQList)
{
string StrStoredProcedureName = string.Empty;
OracleParameter[] ObjArrOracleParameter = null;
DataSet ObjReturnDataSet = new DataSet();
try
{
ObjArrOracleParameter = new OracleParameter[2];
StrStoredProcedureName = "K_SEARCHINCIDENTS.P_GETINCIDENTFOREXPORT";
#region "Set Parameters for stored procedure"
ObjArrOracleParameter[0] = new OracleParameter("P_REVN_SEQLIST", OracleDbType.Varchar2, ParameterDirection.Input);
ObjArrOracleParameter[0].Size = 332767;
ObjArrOracleParameter[0].Value = REVN_SEQList;
ObjArrOracleParameter[1] = new OracleParameter("P_INCIDENTS", OracleDbType.RefCursor, ParameterDirection.Output);
#endregion
ObjReturnDataSet = DB_Manager.ExecuteDataset(DB_Manager.Get_ConnString(), CommandType.StoredProcedure, StrStoredProcedureName, ObjArrOracleParameter);
foreach (DataRow ObjDataRow in ObjReturnDataSet.Tables[0].Rows)
{
if (ObjDataRow["DURATION"].ToString() == "DURATIONCALC")
{
ObjDataRow["DURATION"] = Utilities.DurationCalculation(ObjDataRow["STARTED"].ToString(), ObjDataRow["STOPPED"].ToString(), ObjDataRow["SOURCE_TYPE"].ToString(), ObjDataRow["EVENT_TRIGGER"].ToString());
}
}
return ObjReturnDataSet;
}
catch (Exception ex)
{
throw ex;
}
}
#endregion
=============================================
I tried for few days but haven't been able to figure this out. I get the errors listed below:
Source Error:
An unhandled exception was generated during the execution of the current web request.
Information regarding the origin and location of the exception can be identified using the exception stack trace below.
Stack Trace:
[OracleException (0x80004005): ORA-01460: unimplemented or unreasonable
conversion requested
ORA-06512: at "PADBA.K_SEARCHINCIDENTS", line 397
ORA-06512: at line 1]
WEIS.SearchIncidents.GetIncidentsForExport(String REVN_SEQList) +992
IncidentReviewLogExport.Page_Load(Object sender, EventArgs e) +2931
System.Web.UI.Control.LoadRecursive() +71
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint,
Boolean includeStagesAfterAsyncPoint) +3178`
=======================================================
And line 397 looks like this:
ObjArrOracleParameter[15] = new OracleParameter("P_INCIDENT_NUMBER",OracleDbType.Int32, ParameterDirection.Input);
ObjArrOracleParameter[15].Size = 5;
ObjArrOracleParameter[15].Value = IncidentNumber;