这个是填充GridView的方法,怎么把这3个红色的查出来的数据 传递到其他页面啊??怎么取出来啊,问题是怎么取
  public void DataBindGrid()
  {
  string strCon = "Provider=Microsoft.Jet.OLEDB.4.0;data source=" + HttpContext.Current.Server.MapPath(@"~/minisurvey_360/#db.mdb");
  OleDbConnection con = new OleDbConnection(strCon);
  string str = "SELECT e1.name,r.relation,e2.name from relationship r,employee e1,employee e2 where r.employee1=e1.id and r.employee2=e2.id and e1.name='" + Label1.Text.Trim()+ "'";
  con.Open();
  OleDbCommand c = new OleDbCommand(str, con);
  OleDbDataAdapter oda = new OleDbDataAdapter(c);
  DataSet ds=new DataSet();
  oda.Fill(ds, "table1");
  this.GridView1.DataSource = ds.Tables["table1"];
  this.GridView1.DataBind();  }

解决方案 »

  1.   

    如果要保留查询结果的话,通过Session来保持。
    DataSet ds=new DataSet();
    oda.Fill(ds, "table1");
    Session["result"] = ds;
    但不推荐,因为每个客户端访问的话,服务端会保留N个结果。还是让每个页面自己重新查询吧。你只要传递查询条件就可以了。(通过URL参数)
      

  2.   

    还是让每个页面自己重新查询吧。你只要传递查询条件就可以了。(通过URL参数)
    能写个示例吗
      

  3.   

    比如,你这里要传递的是:Label1.Text.Trim() 对吧。
    画面跳转的时候: Server.Transfer("~/2.aspx?Name=" + Label1.Text.Trim());
    2.aspx的Page_Load里,通过QueryString["Name"]就能取到Label1的值。
    多个URL参数通过&分割传递。另外URL传递的数据不能超过1024byte,如果有中文的话,
    还需要用UrlEncode转义一下,下一个页面还要用UrlDecode来解析一下。