title: error: Not All Code Paths Return A value?
body: <p>I am Getting this Error (Not All Code Paths Return A Value). I want to insert data in my database with unique key constraint. but when i added this in my code my method is giving me this error.</p>
  
  <p>Here is my code</p>
  
  <pre><code>  public string Insert()
      {
  
          SqlConnection Conn = new SqlConnection(@"Data Source=ZARAK\SQLEXPRESS;Initial Catalog=ProjectDAL;integrated security=true");
  
  
          try
          {
              Conn.Open();
              SqlCommand cmd = new SqlCommand("Insert INTO tbl_User(Name,Email,Password) VALUES ('" + name + "','" + email + "','" + password + "')", Conn);
  
  
              int restl = cmd.ExecuteNonQuery();
              //temp = true;
              return "Record Inserted successfully!";
          }
          catch (SqlException ex)
          {
              if (ex.Number == 2627)
              {
                   return "Record Already Exists";
              }
          }
          finally
          {
              Conn.Close();
          }
      }
  </code></pre>