Click here to Skip to main content
14,691,895 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Program execute by recursion function then it's show .... in this part of block
public static DataTable ExecuteSelectCommand(DbCommand command)
{
    DataTable table;
    // The DataTable to be returned
    
    // Execute the command, making sure the connection gets closed in the
    // end
    try
    {
        // Open the data connection
        command.Connection.Open();
        // Execute the command and save the results in a DataTable
        DbDataReader reader = command.ExecuteReader();
        table = new DataTable();
        table.Load(reader);
        // Close the reader
        reader.Close();
    }
    catch (Exception ex)
    {
        utilities.LogError(ex);
        throw;  
    }
    finally
    {
        // Close the connection
        command.Connection.Close();
    }
    return table;
}



[Edit member="Tadit"]
Added pre tags.
[/Edit]
Posted
v2
Comments
Ankur\m/ 27-Nov-14 5:44am
   
How many rows does your query return? Can you also post complete stacktrace?
Amresh Bahadur Singh 27-Nov-14 5:48am
   
Both case return multiple rows or no one records
Sinisa Hajnal 27-Nov-14 6:02am
   
Recursion block...please show that part. This part is simply the one executed one too many times. You have a recursion that goes "too deep", that is, it doesn't have proper final return.
Bernhard Hiller 27-Nov-14 6:02am
   
"Program execute by recursion function" - that is the problem!
Amresh Bahadur Singh 27-Nov-14 6:08am
   
Here work in Batch Process one by one task doing .
records are depend on user request .
so i use recursion function . if any other option please share ...

Amresh Bahadur Singh 27-Nov-14 6:13am
   
Global.aspx
------------
void Application_Start(object sender, EventArgs e)
{

Recurssion();

}

public void Recurssion( )
{

CallFuctionForBatchProcess_Amr objo = new CallFuctionForBatchProcess_Amr();

objo.btndone_OnClick();

Recurssion();

}
Sinisa Hajnal 27-Nov-14 6:20am
   
You need to study recursion a bit more. You're calling Recurssion method within itself WITHOUT ANY WAY TO EXIT!!!

In your particular case, recursion is NOT a solution. You have to create a queue and work from it or enable some way of returning and finishing...recursion does not mean infinite loop...also, take the code out of OnClick so you call something like objo.PerformWork (name it something that makes sense in your application) instead of calling button handler.

Infinite loop can be done by While (1), but again you need a way to exit or your app will never stop unless it crashes.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900