Reputation: 81
i have a problem that i will insert in database mysql from android this information student id - section id -current date -Status each time that user click the buttons it will insert this information in database also i check if the record is duplicate if it is i will told the user you already insert but if not it will insert correctly i try to insert and by change every time the date but it said you already insert how can i solve this problem so i can insert every time a change the date in my database
Upvotes: 0
Views: 118
Reputation: 23982
You are only checking, if the user has given input for the fields or not.
And before inserting the record, you are not checking if such record already exists in database or not.
And may be because of unique constraint if any defined, next inserts are rejected with an exception due to data duplication in fresh input from the user.
Check if any constraints are defined for data uniqueness.
Based on them handle exceptions and inform user accordingly.
Upvotes: 1