When I am debugging the stored procedure it works but my C# code hangs while executing the same stored procedure vai Command.ExecuteNonQuery();
When it stuck I can not use select command also on respective tables.
Can you please guys help me why my Command.ExecuteNonQuery();
is hanging up.
Here are the some code snippets
using (command = manager.CreateStoredProcCommandWrapper(
"UpdatePayrollStagingWithTaxYearID",
new Object[] { HttpContext.Current.Session.SessionID, taxyearID }))
{
manager.ExecuteNonQuery(command);
}
public void ExecuteNonQuery(NTTGDBCommandWrapper commandWrapper)
{
NTTGArgumentValidation.CheckForNullReference(commandWrapper, "commandWrapper");
Stack trans = GetTransactions();
if (trans.Count > 0)
{
GetDatabase().ExecuteNonQuery(commandWrapper.InnerCommand, (IDbTransaction)trans.Peek());
}
else
{
GetDatabase().ExecuteNonQuery(commandWrapper.InnerCommand);
}
}
protected Stack GetTransactions()
{
Stack transactionStack = (Stack)CallContext.GetData(this._contextIdentifierForTransactions);
if (transactionStack == null)
{
transactionStack = new Stack();
CallContext.SetData(this._contextIdentifierForTransactions, transactionStack);
}
return (transactionStack);
}
public virtual void ExecuteNonQuery(DBCommandWrapper command, IDbTransaction transaction)
{
PrepareCommand(command, transaction);
DoExecuteNonQuery(command);
}
private void DoExecuteNonQuery(DBCommandWrapper command)
{
try
{
DateTime startTime = DateTime.Now;
command.RowsAffected = command.Command.ExecuteNonQuery();
this.instrumentation.CommandExecuted(startTime);
}
catch
{
this.instrumentation.CommandFailed(command.Command.CommandText, ConnectionStringNoCredentials);
throw;
}
}