Preventing Duplicate Record Insertion on Page Refresh


Hi

I was getting duplicate data in database while refreshing the page in Registration page. I searched on asp.net forum. Then i got the two type of solution

1. After  insert operation just redirect to that page

protected void BtnSubmit_Click(object sender, EventArgs e)
{

//code for insert

 Response.Redirect(Request.Url.ToString(), false)

}

2. Using sql query, before inserting into database, we have to check that record in database . If that record is available in database stop the execution of code.

For more detail,Please read this article

http://aspalliance.com/687_Preventing_Duplicate_Record_Insertion_on_Page_Refresh.all

Advertisement

7 thoughts on “Preventing Duplicate Record Insertion on Page Refresh

  1. nirmal July 26, 2011 / 1:02 pm

    Use indexing if you are using mysql….it works for duplicate entries….it throws an error that duplicate entry is found

    • Chandra Dev July 27, 2011 / 4:44 am

      Hi
      In first method there is no relation with database.

  2. Nayan Godhani September 21, 2013 / 11:05 am

    thanks…………………………………

  3. viagra April 30, 2014 / 7:55 am

    I believe this is one of the so much vital information for me.

    Annd i’m happy studying your article. However should staterment
    on few basic things, The sitee styoe iis perfect, the articles is actually nice : D.
    Just right job, cheers

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.