Skip to content

WebService for MySQL database #21506

Answered by fire-eggs
ghost asked this question in General
Discussion options

You must be logged in to vote

Numeric ids can often be “auto generated” in databases. In the case of MySQL, you define the column as AUTO_INCREMENT to get this capability. [This would be my personal choice.]

If you want to continue using the manual method, you have two choices:

  1. Track the person id in the caller of your web service, and provide the id to use to the SavePerson function.

  2. In SavePerson, query the database first to find out what the next id would be, then provide that id value when you write to the database. E.g. if you did a “select max(ID) from tblPersonnel” you get the largest ID used, then add one and include it in the INSERT statement. Note that you may end up re-using IDs [e.g. add person A with …

Replies: 4 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants