I have an update statement that not only updates the record it is suppose to but also creates a duplicate record. Any ideas. Here is the statement
strInsert = "update medicaltrans set loginID=@loginID, payperiod=@payperiod, whmonth=@whmonth, payment=@payment, theyear=@theyear where payperiod = @payperiod"
cmdInsert = New SqlCommand(strInsert, dbconn1)
cmdInsert.Parameters.Add("@loginID", employee.SelectedItem.Value)
cmdInsert.Parameters.Add("@payperiod", payperiod.SelectedItem.Text)
cmdInsert.Parameters.Add("@whmonth", amountwithheld.Text)
cmdInsert.Parameters.Add("@payment", amountpayed.Text)
cmdInsert.Parameters.Add("@theyear", dayear.SelectedItem.Text)
cmdInsert.Parameters.Add("@dadate", dayears)
dbconn1.Open()
cmdInsert.ExecuteNonQuery()
dbconn1.Close()
strInsert = "update medicaltrans set loginID=@loginID, payperiod=@payperiod, whmonth=@whmonth, payment=@payment, theyear=@theyear where payperiod = @payperiod"
cmdInsert = New SqlCommand(strInsert, dbconn1)
cmdInsert.Parameters.Add("@loginID", employee.SelectedItem.Value)
cmdInsert.Parameters.Add("@payperiod", payperiod.SelectedItem.Text)
cmdInsert.Parameters.Add("@whmonth", amountwithheld.Text)
cmdInsert.Parameters.Add("@payment", amountpayed.Text)
cmdInsert.Parameters.Add("@theyear", dayear.SelectedItem.Text)
cmdInsert.Parameters.Add("@dadate", dayears)
dbconn1.Open()
cmdInsert.ExecuteNonQuery()
dbconn1.Close()