Hi,
Usually in the catch section a helpful report to the user will be
shown

the ex is of type Exception so :

catch Exception ex
   messageBox.Show(ex.message);
finally
//usually used to release any managed and unmanaged resources.

On Oct 7, 4: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)
>     {
>         SqlConnection Scon = new
> SqlConnection(System.Configuration.ConfigurationManager.AppSettings["ConnectionString"]);
>         Scon.Open();
>         try
>         {
>             SqlCommand cmd = new SqlCommand();
>             cmd = Scon.CreateCommand();
>             cmd.CommandType = CommandType.Text;
>             cmd.CommandText = query;
>             cmd.ExecuteNonQuery();
>
>         }
>         catch (Exception ex)
>         {
>
>         }
>
>         finally
>         {
>             Scon.Close();
>         }
>
>     }
>
>

Reply via email to