Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

update statement inserting

Status
Not open for further replies.

sthmpsn1

MIS
Sep 26, 2001
456
US
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()
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top