Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
- }
Add Comment
Please, Sign In to add comment