title: How can we set catch exception in a label?
body: <p>My Class</p>
  
  <pre><code> public string Countryadd(string country, string id)
       {
  
           string data = "0";
           try
           {
  
  
               string qry1 = "select Country from Country where Country='" + country + "'";//Checking weather txtcountry(Country Name) value is already exixst or not. If exist return 1 and not exists go to else condition
               SqlDataReader dr = conn.query(qry1);
               if (dr.Read())
               {
                   return data = "1";
               }
               else 
               {
  
                   string qry = "insert into Country values('" + id + "','" + country + "')";
                   conn.nonquery(qry);
                   return data = "3";
  
               }
  
           }
  
           catch (Exception ex)
           {
               string x = ex.Message();
           }
  
           return data;
       }
  </code></pre>
  
  <p>this string value how can we set in a label</p>
  
  <p>My button_click function is</p>
  
  <pre><code>protected void Button1_Click(object sender, EventArgs e)
      {
  
          string str = mas.Countryadd(txtcountry.Text, txtid.Text);
          if (str == "1")
          {
              Response.Write("&lt;script&gt;alert('Country Already Exist!!!!')&lt;/script&gt;");
  
          }
          else if (str == "3")
          {
  
              Response.Write("&lt;script&gt;alert('Country Added Succesfully')&lt;/script&gt;");
          }
          else
          {
              Label1.Text = str;
          }
  }
  </code></pre>