Hi
I have top banner in my application which will show an image and i am using "location" session so first page of application allow user to chosse his country and then redirect him to the selected country page. what i am looking for to show each image on the spacific page depending on session. Here is my server code which is not working and the image its not appear
protected void Topbannerimgbtn_Click(object sender, EventArgs e)
{
var location = Convert.ToString(Session["location"]);
using (SqlConnection topbanner = new SqlConnection(sc))
{
topbanner.Open();
SqlDataAdapter DAtopban = new SqlDataAdapter("Select advimg from Adverttop WHERE ([Country] = @Country)", sc);
DataSet DStopban = new DataSet();
DAtopban.SelectCommand.Parameters.AddWithValue("@Country", location);
DAtopban.Fill(DStopban);
bannertoplstviw.DataSource = DStopban.Tables[0];
bannertoplstviw.DataBind();
}
}
and here is aspx code:
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Abhishek JaiswalPosted Jul 15, 2014, 4:19 AM
CHECK OUT THIS ARTICLE:
http://www.c-sharpcorner.com/UploadFile/a20beb/retrieve-image-from-the-database-in-Asp-Net/
:)
Khan Abrar AhmedPosted Jul 15, 2014, 3:26 AM
http://www.c-sharpcorner.com/UploadFile/a20beb/retrieve-image-from-the-database-in-Asp-Net/
Guest UserPosted Jul 8, 2014, 2:22 AM
Session["location"] variable?
Can you share that piece of code also?
twitter @sumitjolly