如何在Session上记录datareader结果?

时间:2015-06-28 11:09:28

标签: c# asp.net database

如何在会话中记录datareader结果?我读了数据库,然后我读到了想要在Session

分配的值
dr = islem.KayitGetir_DataReader("SELECT * FROM products P INNER JOIN products_description PD ON P.products_id = PD.products_id WHERE P.products_id='" + Session[i].ToString() + "'");

if (dr.Read())
{
    cartProductImage.ImageUrl = dr["products_thumbnails_images"].ToString();
    lblCartProductName.Text   = dr["pro_description_name"].ToString();
    lblCartProductPrice.Text  = dr["products_price"].ToString();
    dr.Close();

    Session["ProImg"]      = cartProductImage;
    Session["ProImgName"]  = lblCartProductName;
    Session["ProImgPrice"] = lblCartProductPrice;
}

0 个答案:

没有答案