protected void btnYuce_Click(object sender, EventArgs e) { ResultBLL bll = new ResultBLL(); long start = Environment.TickCount; DataSet ds = bll.GetResult1(DateTime.Parse(txtDate.Text), txtFlightno.Text, txtDepAir.Text, txtArrAir.Text); long end = Environment.TickCount; string result = "|"; for (int i = 0; i < ds.Tables[0].Columns.Count; i++) { result += " " + ds.Tables[0].Rows[0][i].ToString() + " |"; } Page.ClientScript.RegisterStartupScript(GetType(), "", "alert('" + result + "\\n共花费了" + (end - start) + "毫秒')", true); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; ResultBLL bll = new ResultBLL(); string flightno = context.Request["flightno"].ToString(); DateTime date = DateTime.Parse(context.Request["time"].ToString()); string depair = context.Request["depair"].ToString(); string arrair = context.Request["arrair"].ToString(); try { DataSet ds = bll.GetResult1(date, flightno, depair, arrair); string json = Newtonsoft.Json.JsonConvert.SerializeObject(ds.Tables[0], new Newtonsoft.Json.Converters.DataTableConverter()); context.Response.Write(json); } catch (Exception) { context.Response.Write("输入有误,请重新输入!"); } }