Click here to Skip to main content
15,900,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Please someone tell that how to insert and upload images by fileupload control in asp.net c#, I am able to insert the images, but updation is not happening, this is my code, which is insert images



SqlCommand cmd = new SqlCommand();
                cmd.CommandText = "INSERT INTO Images(ImageName,Image) VALUES (@ImageName,@Image)";
                cmd.CommandType = CommandType.Text;
                cmd.Connection = con;
                SqlParameter ImageName = new SqlParameter("@ImageName", SqlDbType.VarChar, 50);
                ImageName.Value = strImageName.ToString();
                cmd.Parameters.Add(ImageName);



Please, someone tell how to update images by same kind of code in asp.net c#


thanks
Posted
Updated 21-Apr-11 19:51pm
v2
Comments
Sandeep Mewara 22-Apr-11 2:00am    
but updation is not happening,
Any error? What happens in update case?

1 solution

Just change the query to update based on the ID in the Images table.
cmd.CommandText = "update Images set ImageName=@ImageName,Image=@Image where id=@ID";
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900