protected void Page_Load(object sender, EventArgs e) { ////Response.Write("<script>alert('123')</script>"); ////Response.Write("<script>alert('" + Session["userName"] + "')</script> "); //if (!IsPostBack) //{ // if (Session["userName"] == null) // { // //Response.Write("<script>alert('789')</script>"); // Response.Redirect("Login1.aspx"); // } // else // { // Loaddata("where ISNULL(已处理) or `已处理`=''"); // } //} GridView1.DataSource = DBhelper2.GetDatasByAdapter("select * from test2").Tables[0]; GridView1.DataBind(); this.GridView1.Rows[0].Cells[0].Text = "testtt"; this.GridView1.Rows[1].Cells[0].Text = "testtt"; this.GridView1.Rows[2].Cells[0].Text = "testtt"; this.GridView1.Rows[3].Cells[0].Text = "testtt"; this.GridView1.Rows[4].Cells[0].Text = "testtt"; this.GridView1.Rows[5].Cells[0].Text = "testtt"; this.GridView1.Rows[6].Cells[0].Text = "testtt"; //this.GridView1.Rows[7].Cells[0].Text = "testtt"; //this.GridView1.Rows[8].Cells[0].Text = "testtt"; //this.GridView1.Rows[9].Cells[0].Text = "testtt"; //this.GridView1.Rows[10].Cells[0].Text = "testtt"; //this.GridView1.Rows[11].Cells[0].Text = "testtt"; }
protected void Page_Load(object sender, EventArgs e) { GridView1.DataSource = DBhelper2.GetDatasByAdapter("select * from test2").Tables[0]; GridView1.DataBind(); this.GridView1.Rows[0].Cells[0].Text = "testtt"; this.GridView1.Rows[1].Cells[0].Text = "testtt"; this.GridView1.Rows[2].Cells[0].Text = "testtt"; this.GridView1.Rows[3].Cells[0].Text = "testtt"; this.GridView1.Rows[4].Cells[0].Text = "testtt"; this.GridView1.Rows[5].Cells[0].Text = "testtt"; this.GridView1.Rows[6].Cells[0].Text = "testtt"; }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string result = ""; DataSet ds = DBhelper2.GetDatasByAdapter("SELECT * FROM TEST1 "); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { foreach (DataRow dr in ds.Tables[0].Rows) { result += dr["Product Name"] + ","; } } context.Response.Write(result); }