I want to delete a record which is related to the SerialNo in the database.
This is my code:
Using con = New MySqlConnection("server=" & server & ";" & "user id=" & userid & ";" & "password=" & password & ";" & "database=" & database)
con.Open()
Dim sqlText = "DELETE * FROM datatable WHERE SerialNo = @ulogin"
Using cmd = New MySqlCommand(sqlText, con)
cmd.Parameters.AddWithValue("@ulogin", frmmain.txtinput.Text)
cmd.ExecuteNonQuery()
End Using
con.Close()
End Using
This code doesn't work. When I run the program, the following error appears:
Please be kind enough to suggest a suitable solution.
NOTE: 221 means the entered number.

DataType, I would explicitly set it like socmd.Parameters.Add("@ulogin", SqlDbType.Int).Value =ExecuteNonQueryis a function telling you how many rows were affected:Dim rows = ExecuteNonQuery()is the place to start. If it is non zero something was deletedcmd.Parameters.AddWithValue("@ulogin", CInt(frmmain.txtinput.Text))... convert thattxtinput.texttointeger... of course, made some validation if You enter something other then number.