liquidspaces
Well-known member
This is what Im trying to do:
On my form, I have fields where the user can enter in an assortment of different information. Also on the form is a unique identifying number which when saved to the database is the primary key in a table.
Lets say that the user enters in half of the information and then clicks save. The user then realizes that they forgot to fill in the rest of it so he fills it in and then clicks save again. As it stands right now, the program will crash because its trying to duplicate a primary key in the database. This of course is bad, but I honestly cant get it to work the way I need it to.
Since Im saving to a database and the primary key of this table is the unique identifying number, how can I:
1)Check to see if there is already a primary key field with the same value and:
2)Edit that row if the primary key already exists?
Id prefer to do this all through the click event for the "save" button.
Thanks,
Kevin
On my form, I have fields where the user can enter in an assortment of different information. Also on the form is a unique identifying number which when saved to the database is the primary key in a table.
Lets say that the user enters in half of the information and then clicks save. The user then realizes that they forgot to fill in the rest of it so he fills it in and then clicks save again. As it stands right now, the program will crash because its trying to duplicate a primary key in the database. This of course is bad, but I honestly cant get it to work the way I need it to.
Since Im saving to a database and the primary key of this table is the unique identifying number, how can I:
1)Check to see if there is already a primary key field with the same value and:
2)Edit that row if the primary key already exists?
Id prefer to do this all through the click event for the "save" button.
Thanks,
Kevin