When cancel on new, record is still created

Using 2008 SQL Server Management Studio and am using Microsoft Visual Web Developer 2008 Express Edition

New MasterID created via "New" button & on subsequent pages the user is to select the components to be added by passing MasterID to individual pages that are automatically assigned PageID when request for "new" component(PAGE) .  This takes them to a details view page where they are to answer many question & submit(or rather update) for those answer to be written to database.

Problem is if I request a "new" record to be created, the new pageID is created & passed to detailsview.   Say I then want to "cancel" rather than update.  What code do I include in my "cancel" button to delete this new record?

Code from Detailview page where "New" button lives...
    Protected Sub btnNew_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnNew.Click
        Me.SqlDataSource1.InsertParameters("MasterId").DefaultValue = Session("RFQMasterId")
       Dim iReturn As Int32 = Me.SqlDataSource1.Insert()
        Response.Redirect("CorrDisch.aspx")
        Dim sValue As String = Me.GridView1.Rows(Me.GridView1.Rows.Count - 1).Cells(1).Text
        Session("corrId") = sValue
        Response.Redirect("CorrDischDetail.aspx")
    End Sub
Code for Detailsview cancel/update:
Protected Sub DetailsView1_ItemCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DetailsViewCommandEventArgs) Handles DetailsView1.ItemCommand
        If e.CommandName = "Cancel" Then
            Response.Redirect("CorrDisch.aspx")
        ElseIf e.CommandName = "Update" Then
        Else
            MsgBox("ItemCommand " + e.CommandName)
        End If
    End Sub

Protected Sub SqlDataSource1_Updated(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.SqlDataSourceStatusEventArgs) Handles SqlDataSource1.Updated
        Response.Redirect("CorrDisch.aspx")
    End Sub
acs6699Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

VishnukumarCommented:
Please use SavePoint and Rollback functionality to rollback your transactions.
acs6699Author Commented:
I am trying to do that.  Will let you know how it turns out.  Thanks
VishnukumarCommented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
acs6699Author Commented:
thanks a million
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Development

From novice to tech pro — start learning today.