I receive the following error: "Conversion from string "Invalid SQL statement; expected " to type 'Integer' is not valid."
Here's my code that I expected to update information in database:
Private Sub Updatebtn_Click(sender As System.Object, e As System.EventArgs) Handles Updatebtn.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text = "" Or TextBox5.Text = "" Or ComboBox1.Text = "" Then
MsgBox("Please Fill All Details")
Exit Sub
End If
Try
con.Close()
con.Open()
str = "UPATE Customers set CustomerName=@name,Address=@Address,Phone=@Phone,EyePower=@EP,ConsutantDoctor=@CD where CustomerID=@CID"
cmd = New OleDbCommand(str, con)
cmd.Parameters.AddWithValue("@name", TextBox1.Text)
cmd.Parameters.AddWithValue("@Address", TextBox2.Text)
cmd.Parameters.AddWithValue("@Phone", TextBox3.Text)
cmd.Parameters.AddWithValue("@EP", TextBox4.Text)
cmd.Parameters.AddWithValue("@CD", TextBox5.Text)
cmd.Parameters.AddWithValue("@CID", ComboBox1.Text)
cmd.ExecuteNonQuery()
MsgBox("Record Updated Successfully", MsgBoxStyle.Information, MsgBoxStyle.OkOnly)
Catch ex As Exception
MsgBox("Error", ex.Message)
Finally
con.Close()
End Try
End Sub