Hi!
I have this code to insert records
I want to update ONLY the subjects assigned to a certain students. can you help me convert the code above into Update query?
Thanks.
I have this code to insert records
Code:
'insert all selected subjects
y = Me.BindingContext(dsSub.Tables("tblSubjects")).Count - 1
Me.BindingContext(dsSub.Tables("tblSubjects")).Position = 0
For x = 0 To y
cmdStudList.CommandText = "INSERT INTO tblregister(IDNo,SubjectName, " & _
"FirstName,MI,LastName,YearLevel, Address,Gender) " & _
"VALUES ('" & txtStudID.Text & "','" & txtSubjectName.Text & _
"','" & txtFirstName.Text & "', '" & txtMI.Text & _
"','" & txtLastName.Text & "','" & cboYearLevel.Text & _
"','" & SQLEncode(txtCompleteAddress.Text) & "','" & txtGender.Text & "')"
daStud.InsertCommand = cmdStudList
daStud.InsertCommand.ExecuteNonQuery()
Me.BindingContext(dsSub.Tables("tblSubjects")).Position += 1
'Debug.Print("INSERT INTO tblregister(IDNo, SubjectId) VALUES ('" & txtIDNo.Text & "', '" & txtSubjectID.Text & "')")
daStud.InsertCommand = cmdStudList
Next
Thanks.