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
Saurabh Bhardwaj
NA
14
14.1k
Image does not shown
Aug 16 2012 6:44 AM
Good Afternoon.
I am workin on online shopping project. My productDetails.aspx code is like :
protected void Button1_Click(object sender, EventArgs e)
{ SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;initial catalog=pankshi;integrated security=true"); SqlCommand cmd = new SqlCommand("insert into tbl_addtocart" + "(productcode,bname,imgpath,cost,qty,totcost)" + "values" + "(@productcode,@bname,@imgpath,@cost,1,@totcost)",con); cmd.Parameters.Add(new SqlParameter("@productcode",Labelproductcode .Text )); cmd.Parameters.Add(new SqlParameter("@bname", Labelbrandname.Text)); cmd.Parameters.Add(new SqlParameter("@imgpath", "~/Handler.ashx?Pid=" + ImageId)); cmd.Parameters.Add(new SqlParameter("@cost", Labelcost.Text)); cmd.Parameters.Add(new SqlParameter("@totcost", Labelcost.Text)); try { con.Open(); cmd.ExecuteNonQuery(); con.Close(); Response.Redirect("addtocart.aspx"); }
catch (SqlException ex) { string errorMessage = "Error in registering user"; errorMessage += ex.Message; throw new Exception(errorMessage); }
finally { con.Close(); } }
but my imagespath not saved as usual.therefpre my image are not shown in my addtocart.aspx page.
My addtocart.aspx is like protected void Page_Load(object sender, EventArgs e) { SqlConnection con = new SqlConnection("Data Source=.\\sqlexpress;Initial Catalog=pankshi;integrated security=True;"); con.Open(); sql = "select * from tbl_addtocart"; ds = new DataSet(); da = new SqlDataAdapter(sql,con); da.Fill(ds,"tbl_addtocart"); GridView1.DataSource = ds; GridView1.DataBind(); } please give me rig
Reply
Answers (
1
)
Sequence Contains more than one element.
Button click not firing after hosting in production server