2
I needed to do a query that worked as the following example:
In the print you can see that by typing an item, returns structured by neighborhood and then city.
I wanted to know how to do my query this way, structured by Neighborhood, City and Street. I can only implement the simple way and link it to Textbox, according to the following file:
public class AutocompleteData : IHttpHandler {
public void ProcessRequest (HttpContext context) {
string firstname = context.Request.QueryString["q"];
string sql = "SELECT Bairro FROM [Bairro] where Bairro like '" + Bairro +
"%' ; ";
string conexao =
ConfigurationManager.ConnectionStrings["ctString"].ToString();
using (SqlConnection connection = new SqlConnection(conexao))
using (SqlCommand command = new SqlCommand(sql, connection))
{
connection.Open();
using (SqlDataReader reader = command.ExecuteReader())
{
List<string> list = new List<string>();
while (reader.Read())
{
context.Response.Write(reader[0].ToString() + Environment.NewLine);
}
}
}
}
public bool IsReusable {
get {
return false;
}
}
}