the script is running on F5 too !!!!!

Nov 11, 2011 at 6:43 AM

hey , im new here

i have a question

this is my code

everyting is ok but when i click on F5 , it refresh the page and run the code another time

means a new record is added to the data base on each F5



Imports System.Data.OleDb
Partial Class Default2
    Inherits System.Web.UI.Page

    Protected Sub Button3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button3.Click
        Dim myConn As OleDbConnection
        Dim cmd As OleDbCommand
        Dim sqlstring, Fname, Lname, FATHname, Region As String

        Fname = TextBox1.Text
        Lname = TextBox2.Text
        FATHname = TextBox3.Text
        Region = TextBox4.Text

        myConn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\Users\pcuser10.comm\Documents\")


        sqlstring = " INSERT INTO Table1 (FNAME, LNAME, FATHNAME, REGION) VALUES ('" + Fname + "','" + Lname + "','" + FATHname + "','" + Region + "')"

        cmd = New OleDbCommand(sqlstring, myConn)

    End Sub
End Class