I have a sub below where I am trying to update records. This sub is basically a copied insert and I am wondering how I would change it to update a records based on the value in loginID???
Sub update_click( s As Object, e As EventArgs )
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim strInsert As String
Dim cmdInsert As SqlCommand
myConnection = New SqlConnection( "server=am1st_fs1;database=HRINFO;uid=sa" )
strInsert = "insert health ( loginID, healthparticipant, healthkind, healtheffective, dental, dentalkind, dentaleffective, logtemdisibilty, class, life, businesstravel, busclass, supplelife ) Values ( @loginID, @healthpart, @healthkind, @healtheffective, @dental, @dentalkind, @dentaleffective, @logtem, @class, @life, @bustravel, @busclass, @supplelife )"
cmdInsert = New SqlCommand( strInsert, myConnection )
cmdInsert.Parameters.Add( "@loginID", usernameup1.Text )
cmdInsert.Parameters.Add( "@healthpart", healthpart1.Text )
cmdInsert.Parameters.Add( "@healthkind", healthkind1.Text )
cmdInsert.Parameters.Add( "@healtheffective", healthdate.Text )
cmdInsert.Parameters.Add( "@dental", dentalpart1.Text )
cmdInsert.Parameters.Add( "@dentalkind", dentalkind1.Text )
cmdInsert.Parameters.Add( "@dentaleffective", dentaldate1a.Text )
cmdInsert.Parameters.Add( "@logtem", longpart1.Text )
cmdInsert.Parameters.Add( "@class", class1a.Text )
cmdInsert.Parameters.Add( "@life", lifepart1.Text )
cmdInsert.Parameters.Add( "@bustravel", bussinesspart1.text )
cmdInsert.Parameters.Add( "@busclass", class2a.Text )
cmdInsert.Parameters.Add( "@supplelife", supplepart1.Text )
Sub update_click( s As Object, e As EventArgs )
Dim myConnection As SqlConnection
Dim myCommand As SqlCommand
Dim strInsert As String
Dim cmdInsert As SqlCommand
myConnection = New SqlConnection( "server=am1st_fs1;database=HRINFO;uid=sa" )
strInsert = "insert health ( loginID, healthparticipant, healthkind, healtheffective, dental, dentalkind, dentaleffective, logtemdisibilty, class, life, businesstravel, busclass, supplelife ) Values ( @loginID, @healthpart, @healthkind, @healtheffective, @dental, @dentalkind, @dentaleffective, @logtem, @class, @life, @bustravel, @busclass, @supplelife )"
cmdInsert = New SqlCommand( strInsert, myConnection )
cmdInsert.Parameters.Add( "@loginID", usernameup1.Text )
cmdInsert.Parameters.Add( "@healthpart", healthpart1.Text )
cmdInsert.Parameters.Add( "@healthkind", healthkind1.Text )
cmdInsert.Parameters.Add( "@healtheffective", healthdate.Text )
cmdInsert.Parameters.Add( "@dental", dentalpart1.Text )
cmdInsert.Parameters.Add( "@dentalkind", dentalkind1.Text )
cmdInsert.Parameters.Add( "@dentaleffective", dentaldate1a.Text )
cmdInsert.Parameters.Add( "@logtem", longpart1.Text )
cmdInsert.Parameters.Add( "@class", class1a.Text )
cmdInsert.Parameters.Add( "@life", lifepart1.Text )
cmdInsert.Parameters.Add( "@bustravel", bussinesspart1.text )
cmdInsert.Parameters.Add( "@busclass", class2a.Text )
cmdInsert.Parameters.Add( "@supplelife", supplepart1.Text )