C \ # 액세스 세 션 값

794 단어 c#
 //  Session
    protected void Button1_Click(object sender, EventArgs e)
    {
        string[] str = new string[] { "A", "B", "C", "D" };
        Session["str"] = str;
       Session["ds"] =Class1.ExecuteDataset("Data Source=.;Initial Catalog=northwnd;User ID=sa;Password=123", "select * from product", CommandType.Text, null);
    }


    //  Session
    protected void Button2_Click(object sender, EventArgs e)
    {
        object o = Session["str"];
        string[] str =(string[])o;
        foreach (string item in str)
        {
            Response.Write(item + "
"); } GridView1.DataSource = (DataSet)Session["ds"]; GridView1.DataBind(); }

좋은 웹페이지 즐겨찾기