Guest User

Untitled

a guest
Apr 20th, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. public class AutocompleteData : IHttpHandler {
  2.  
  3. public void ProcessRequest (HttpContext context) {
  4. string firstname = context.Request.QueryString["q"];
  5. string sql = "SELECT Bairro FROM [Bairro] where Bairro like '" + Bairro +
  6. "%' ; ";
  7. string conexao =
  8. ConfigurationManager.ConnectionStrings["ctString"].ToString();
  9. using (SqlConnection connection = new SqlConnection(conexao))
  10. using (SqlCommand command = new SqlCommand(sql, connection))
  11. {
  12. connection.Open();
  13.  
  14. using (SqlDataReader reader = command.ExecuteReader())
  15. {
  16. List<string> list = new List<string>();
  17. while (reader.Read())
  18. {
  19. context.Response.Write(reader[0].ToString() + Environment.NewLine);
  20. }
  21. }
  22. }
  23. }
  24.  
  25. public bool IsReusable {
  26. get {
  27. return false;
  28. }
  29. }
  30.  
  31. }
Add Comment
Please, Sign In to add comment