protected void Page_Load(object sender, EventArgs e) { //默认传入的键值为q if (Request.QueryString["q"] != null) { string key = Request.Params["q"].ToString(); string result = ""; db db = new db(); string sql = "select UserName from Users where UserName like '" key "%'"; SqlDataReader dr = db.GetReader(sql); while (dr.Read()) { result = dr["UserName"].ToString() "n"; } if (result == "") result = "not exists"; Response.Write(result); } }