If at first you don't succeed...




  • try
    {
                sqlConnection.Open();
                sqlCommandTradeReview.CommandText = "GetTradeTypes";
                sqlCommandTradeReview.CommandType = System.Data.CommandType.StoredProcedure;
                sqlCommandTradeReview.Connection = sqlConnection;

                oTradeReviewReader =  sqlCommandTradeReview.ExecuteReader();
                if(oTradeReviewReader.HasRows)
                {
                            while(oTradeReviewReader.Read())
                            {
                                        System.Web.UI.WebControls.ListItem li = new ListItem(oTradeReviewReader["SearchListDesc"].ToString(),oTradeReviewReader["ReviewReasonID"].ToString());
                                        lstFlaggedTrades.Items.Add(li);
                            }
                }                      
    }
    catch(Exception e)
    {
                string x = e.ToString(); //If we have an error, continue processing.
    }
    finally
    {
                //-- Perform all cleanup routines in the finally section.
                //-- Try to close the reader.  Ignore all errors.
                try
                {
                            oTradeReviewReader.Close() ;
                            oTradeReviewReader = null ;
                }
                catch
                {}
                
                //-- Try to dispose of the command.  Ignore all errors.
                try
                {
                            sqlCommandTradeReview.Dispose() ;
                            sqlCommandTradeReview = null ;
                }
                catch
                {}
                
                //-- Try to close the connection.  Ignore all errors.
                try
                {
                            sqlConnection.Close() ;                                                  
                }
                catch
                {}  
    }

     

    ----------------------------------
    <sarcasm>Yay! I love legacy code!</sarcasm>
    <?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>


Log in to reply