not all code paths return a value error on web method <p>I have a web method function has checks if a name exists in the database but I am getting the error:</p> <blockquote> <p>Error 114 'lookups_Creditor.CheckIfNameExists(string)': not all code paths return a value</p> </blockquote> <p>Here is the web method:</p> <pre><code>[WebMethod] public static bool CheckIfNameExists(string Name)//error on this line { try { Creditor.CheckIfNameCreditorExists(Company.Current.CompanyID, Name); } catch (Exception ex) { } } </code></pre> <p>And here is the search function for the sql:</p> <pre><code>public static string CheckIfNameCreditorExists(int CompanyID, string Name) { DataSet ds = new DataSet(); string accNo = ""; string sql = "proc_CheckIfACCreditorExists"; string query = "SELECT c.* " + " FROM Creditor c " + " WHERE c.Company_ID = " + CompanyID + " AND c.Name LIKE '" + Name + "' "; DataTable dt = new DataTable(); using (MySql.Data.MySqlClient.MySqlDataAdapter adapter = new MySql.Data.MySqlClient.MySqlDataAdapter(query, DataUtils.ConnectionStrings["TAT"])) { adapter.SelectCommand.CommandType = CommandType.Text; adapter.SelectCommand.CommandText = query; adapter.Fill(dt); if (dt.Rows.Count &gt; 0) { accNo = Convert.ToString(dt.Rows[0]["AccoutCode"]); } } return accNo; } </code></pre> <p>I am trying to create a method that searches for the name in the database. If the name exists, then return the account code associated with that name. I will the display a message on the screen telling the user that the name already exists on the account ABC.</p>