[Solved] Double data insert into database asp.net c#


You have two bad practices going on here.

First, you should use sql parameters instead of simply concatenating them; to avoid SQL injection. Read here.

Second, don’t do an insert in a HTTP GET (Page_Load). You should do this in a HTTP POST and then redirect to an HTTP GET again (PRG pattern).

The reason of the double insert may be because you hit the same page twice (Page_Load in this case); something you would have noticed if you apply the PRG pattern.

See Post-Redirect-Get with ASP.NET.

solved Double data insert into database asp.net c#