Hmmm I guess you are referring to bubbling exceptions, i.e. a catch
 block only (without an exception) would be complimented by a throw
 clause within the block which would in turn raise the same exception
 to be handled by higher level code.

See official MSDN documentation here 
http://msdn.microsoft.com/en-us/library/0yd65esw(VS.71).aspx

On Oct 8, 6:48 am, Stephen Russell <[email protected]> wrote:
> // answers in line
>
> On Thu, Oct 7, 2010 at 6:00 AM, Gourav <[email protected]> wrote:
> > Hi All ,
> >   I just make a connection class in App_code .But i didn't know what
> > i write in catch block for Error exception.Any body can tell me ??
> > i'll wait for reply.....
> > and one more thind what is differance between
> > catch and  catch (Exception ex)....means in which condition we use it
> > <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
> > public static void ExecuteNonQuery(string query)
>
> -----------------
>
> Does it matter at all?  This is a void, thus you don't care what
> happens in the process.
>
> Why not return a string?
>
> >    {
> >        SqlConnection Scon = new
> > SqlConnection(System.Configuration.ConfigurationManager.AppSettings["Connec 
> > tionString"]);
> >        Scon.Open();
>
> StringOhNo;
>
> >        try
> >        {
> >            SqlCommand cmd = new SqlCommand();
> >            cmd = Scon.CreateCommand();
> >            cmd.CommandType = CommandType.Text;
> >            cmd.CommandText = query;
>
> OhNo = cmd.ExecuteNonQuery() > 0  ? "cool" : "no records manipulated";
>
> >        }
> >        catch (Exception ex)
> >        {
>
>                 OhNo = ex.Message;
>
> >        }
>
> >        finally
> >        {
> >            Scon.Close();
> >        }
>
> return OhNo;
>
> >    }
>
> --
> Stephen Russell
>
> Sr. Production Systems Programmer
> CIMSgts
>
> 901.246-0159 cell

Reply via email to