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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

updating records

Status
Not open for further replies.

sthmpsn1

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

Part and Inventory Search

Sponsor

Back
Top