enter code here
Private Sub BTNupdate_Click(sender As Object, e As EventArgs) Handles BTNupdate.Click
con.Open()
Dim LRN As Integer = TextBoxLRN.Text
Dim FullName As String = TextBoxFullName.Text
Dim Gender As String = ComboBoxGen.SelectedItem
Dim Course As String = TextBoxCourse.Text
Dim Section As String = TextBoxSection.Text
query = "UPDATE StudentInfoTbl SET [FULL NAME] = '" & TextBoxFullName.Text & "', [GENDER] = '" & ComboBoxGen.SelectedItem & "', [COURSE] = '" & TextBoxCourse.Text & "', [SECTION] = '" & TextBoxSection.Text & "' WHERE [LRN] = '" & TextBoxLRN.Text & "';"
cmd.Connection = con
cmd.CommandText = query
cmd.ExecuteNonQuery()
cmd.Parameters.AddWithValue("@LRN", LRN)
cmd.Parameters.AddWithValue("@FULL NAME", FullName)
cmd.Parameters.AddWithValue("@GENDER", Gender)
cmd.Parameters.AddWithValue("@COURSE", Course)
cmd.Parameters.AddWithValue("@SECTION", Section)
MessageBox.Show("Record hass been successfully updated!", "Record Saved", MessageBoxButtons.OK, MessageBoxIcon.Information)
ClearTextBox()
BindData()
con.Close()
End Sub
I'm having an error that says "no value given for one or more required parameters" I think it is because in my cmd.parameters? please help me out thank youu