TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Paul
NA
13
0
Image vs Session Variables
Aug 22 2011 9:51 AM
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();
Reply
Answers (
1
)
How to bind DropDownList with SQL server in asp.net
How to bind GridView with sql server database