public void EditImageAndInfo(image_sliderBO img_obj) { try { if (newcon.State == ConnectionState.Closed) { newcon.Open(); } query = "UPDATE image_slider SET img_info = @img_info where img_id = @img_id"; command = new SqlCommand(query, newcon); command.Parameters.AddWithValue("@img_info", img_obj.img_info.ToString()); command.Parameters.AddWithValue("@img_id", img_obj.img_id); command.ExecuteNonQuery(); } catch { throw; } finally { command.Dispose(); if (newcon.State == ConnectionState.Open) { newcon.Close(); } } }
public void EditImageAndInfo(image_sliderBO img_obj) { try { sliderfunctions.EditImageAndInfo(img_obj); } catch { throw; } }
} //load the image to the slider public void SaveNewImage(String image_name) { try { if (newcon.State == ConnectionState.Closed) { newcon.Open(); } Next_ID generateimageid = new Next_ID(); image_sliderBO newimage = new image_sliderBO(); newimage.img_id = generateimageid.incrementer("img_id", "image_slider"); newimage.img_link = "../Images/sliderImages/" + image_name; String query = "insert into image_slider(img_id,img_link) values(@img_id,@img_link)"; command = new SqlCommand(query, newcon); command.Parameters.AddWithValue("@img_id", newimage.img_id); command.Parameters.AddWithValue("@img_link", newimage.img_link); command.ExecuteNonQuery(); } catch { throw; } finally { if (newcon.State == ConnectionState.Open) { newcon.Close(); } } }