Problem:
Can't Update my Access Database
Error: No value Given for one or more required parameters.
Additional Info:
I'm using SchoolName as my PK. so iremoved it from the Update SQL.
Also I dont know if my where clause is correct or not.
OR the whole Update SQL is Wrong.
PLease Help
What I have tried:
Dim cmd As OleDbCommand
Dim con As OleDbConnection
Try
con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & Application.StartupPath & "\PLAN.mdb")
cmd = New OleDbCommand("Update Elementary SET KM=?,KF=?,KT=?,G1M=?,G1F=?,G1T=?,G2M=?,G2F=?,G2T=?,G3M=?,G3F=?,G3T=?,G4M=?,G4F=?,G4T=?,G5M=?,G5F=?,G5T=?,G6M=?,G6F=?,G6T=?,ESTOTAL=?,SY=? where KM=?", con)
con.Open()
cmd.Parameters.AddWithValue("@KM", KMTextBox.Text)
cmd.Parameters.AddWithValue("@KF", KFTextBox.Text)
cmd.Parameters.AddWithValue("@KT", KTTextBox.Text)
cmd.Parameters.AddWithValue("@G1M", G1MTextBox.Text)
cmd.Parameters.AddWithValue("@G1F", G1FTextBox.Text)
cmd.Parameters.AddWithValue("@G1T", G1TTextBox.Text)
cmd.Parameters.AddWithValue("@G2M", G2MTextBox.Text)
cmd.Parameters.AddWithValue("@G2F", G2FTextBox.Text)
cmd.Parameters.AddWithValue("@G2T", G2TTextBox.Text)
cmd.Parameters.AddWithValue("@G3M", G3MTextBox.Text)
cmd.Parameters.AddWithValue("@G3F", G3FTextBox.Text)
cmd.Parameters.AddWithValue("@G3T", G3TTextBox.Text)
cmd.Parameters.AddWithValue("@G4M", G4MTextBox.Text)
cmd.Parameters.AddWithValue("@G4F", G4FTextBox.Text)
cmd.Parameters.AddWithValue("@G4T", G4TTextBox.Text)
cmd.Parameters.AddWithValue("@G5M", G5MTextBox.Text)
cmd.Parameters.AddWithValue("@G5F", G5FTextBox.Text)
cmd.Parameters.AddWithValue("@G5T", G5TTextBox.Text)
cmd.Parameters.AddWithValue("@G6M", G6MTextBox.Text)
cmd.Parameters.AddWithValue("@G6F", G6FTextBox.Text)
cmd.Parameters.AddWithValue("@G6T", G6TTextBox.Text)
cmd.Parameters.AddWithValue("@ESTOTAL", ESTOTALTextBox.Text)
cmd.Parameters.AddWithValue("@SY", SYTextBox.Text)
cmd.ExecuteNonQuery()
MsgBox("Record Updated")
con.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try