- Joined
- Nov 16, 2006
- Messages
- 3
- Reaction score
- 0
Hi,
I am using Oracle Client to Connect to DB. I am calling a Stored Procedure using Command object and the data returned I am filling in a DataSet with the OracleDataAdaper's .Fill() method.
The code I am writing is as below...
public DataSet getCategory()
{
try
{
if (Global.objConn.State.ToString().ToUpper() == "CLOSED")
{
Global.objConn.Open();
}
OracleCommand objComm = new OracleCommand ("p_getCategoryMaster",Global.objConn);
objComm.CommandType = CommandType.StoredProcedure;
objComm.Parameters.Add(new OracleParameter ("pCategoryID",OracleType.VarChar)).Value = CategoryID;
objComm.Parameters.Add(new OracleParameter ("pLangID",OracleType.VarChar)).Value = LanguageID;
objComm.Parameters.Add(new OracleParameter ("cur_Cat",OracleType.Cursor)).Direction = ParameterDirection.Output;
DataSet ds = new DataSet();
OracleDataAdapter objData = new OracleDataAdapter(objComm);
objData.Fill(ds);
objData.Dispose();
objComm.Dispose();
Global.objConn.Close();
return ds;
}
catch(Exception ex)
{
Log.LogInfo("DataUtility : " + ex);
returnnull;
}
finally
{
Global.objConn.Close();
}
}
It works fine.. But if 3/4 users simultaneously doing the processes, sometimes it throws the exception as OracleDataReader is closed. This Exception is thrown while filling the DataSet.
Can anybody tell me what is wrong in my code or what changes I have to make to get it worked.
I am stuck here. Please reply me as soon as possible....
Thanks
I am using Oracle Client to Connect to DB. I am calling a Stored Procedure using Command object and the data returned I am filling in a DataSet with the OracleDataAdaper's .Fill() method.
The code I am writing is as below...
public DataSet getCategory()
{
try
{
if (Global.objConn.State.ToString().ToUpper() == "CLOSED")
{
Global.objConn.Open();
}
OracleCommand objComm = new OracleCommand ("p_getCategoryMaster",Global.objConn);
objComm.CommandType = CommandType.StoredProcedure;
objComm.Parameters.Add(new OracleParameter ("pCategoryID",OracleType.VarChar)).Value = CategoryID;
objComm.Parameters.Add(new OracleParameter ("pLangID",OracleType.VarChar)).Value = LanguageID;
objComm.Parameters.Add(new OracleParameter ("cur_Cat",OracleType.Cursor)).Direction = ParameterDirection.Output;
DataSet ds = new DataSet();
OracleDataAdapter objData = new OracleDataAdapter(objComm);
objData.Fill(ds);
objData.Dispose();
objComm.Dispose();
Global.objConn.Close();
return ds;
}
catch(Exception ex)
{
Log.LogInfo("DataUtility : " + ex);
returnnull;
}
finally
{
Global.objConn.Close();
}
}
It works fine.. But if 3/4 users simultaneously doing the processes, sometimes it throws the exception as OracleDataReader is closed. This Exception is thrown while filling the DataSet.
Can anybody tell me what is wrong in my code or what changes I have to make to get it worked.
I am stuck here. Please reply me as soon as possible....
Thanks