Author: amirzandi | Posted on: 6/30/2010 5:12:38 AM | Views : 1277

Dear All,
I have a simple Insert Query and placed it at Page Load of my page, each time the page is loaded, it runs this INSERT COMMAND twice and inserts two rows to DATABASE.
I have also set the AutoEvenWireup to FALSE, but did not solve my problem.
 
Here is the Insert Command at the Page Load:
Dim con As New SqlConnection(db) Dim cmd As New SqlCommand("INSERT INTO [Visit] (agahi_id, date) VALUES (@id, @date)", con) Dim id As String = Request.QueryString.Item("id") con.Open() cmd.Parameters.AddWithValue("@id", ID) cmd.Parameters.AddWithValue("@date", DateTime.Now.ToShortDateString) cmd.Connection = con cmd.ExecuteNonQuery() con.Close()
 
...

Go to the complete details ...