Hello,
I would like to know how to:
- Save an image into a Session Variables
- Get the image from the Session Variable and display it on the web page.
Here's the example on how to get the image from the DB:
string v_customer_code = "PAUL";
SqlConnection v_connection = newSqlConnection(ConfigurationManager.ConnectionStrings["SqlServer"].ConnectionString))
v_connection_string = "SELECT [Photo] FROM [customers] WHERE [code] = @CODE";
SqlCommand cmd = new SqlCommand(SQL, v_connection);
cmd.Parameters.AddWithValue("@CODE", v_customer_code);
v_connection.Open();
SqlDataReader dr = cmd.ExecuteReader();
if(dr.Read())
{
Session["Customer_Photo"] = (byte[])dr["Photo"]; ????? is it correct ?
}
dr.Close();
v_connection.Close();
Thank you
I really appreciate your help
Paul