you are also updating
ImagePath
and other columns with name column.All will get effected and if you are not selecting any image while updating then the following query gives error.
string str = "update ImagesPath set Name='" + TextBox4.Text + "',Link='" + TextBox5.Text + "',ImagePath='" + "images/" + f + "',Status='"+DropDownList2.SelectedItem.Text+"' where ID='" + DropDownList1.SelectedItem.Text + "'";
So better maintain a
flag
that will specify either you are doing
insert
or
update
..
Thanks