Hi, I have code that increments values
protected void IncrementOccur_Click(object sender, EventArgs e)
{
if (Page.IsValid)
{
//build object to insert occurrance
Ad a = new Ad();
a.AdID = Convert.ToInt32(ddlAddtype.SelectedValue);
a.AdRef = Session["SessAppRef"].ToString();
a.AdOcc = 1;
try
{
//insert advert object into db
AdManager.InsertAdOccRef(a);
//rebind the gridview
GridViewHistory.DataBind();
//reset the advert occurance label
lblAdOc.Text = CountAdRef();
}
catch (Exception ex)
{
}
}
}
This work grands and it increments. Now I need one for it to decrement. I'm not sure if the code is going to be the similar to what I already have? Obviously I would be inserting an Occurrance il be updating the occurance by -1. The way this works is Ive a database table that stores the information and everytime the increment button is clicked it saves it into the database. I have an SQL stored procedure that inserts the values into the database and instead of using sqldatasource we use objectdatasources. Any suggestios please