J
Joe Reggae
Using c# and Visual Studio 2003, I've begun to wonder whether I'm adding
rows to Oracle tables correctly. The tables often have "row ID" columns and,
before adding a row, I pull the "max" ID value from a table, add 1 to it,
and then use that number as the new "row ID" (the base table then gets
updated, so the dataset and table are not long out of sync). I'm sure this
approach is wrong, since, among other issues, the "max" ID returned could be
wrong if, for instance, a recently-added row was deleted. I don't know,
however, how else to do this. Should I instead use stored procedures? How
can I add rows to my dataset tables and know what "row ID" the underlying
table will expect during the row insert (especially with other users
potentially hitting the database)? Thanks for advice.
rows to Oracle tables correctly. The tables often have "row ID" columns and,
before adding a row, I pull the "max" ID value from a table, add 1 to it,
and then use that number as the new "row ID" (the base table then gets
updated, so the dataset and table are not long out of sync). I'm sure this
approach is wrong, since, among other issues, the "max" ID returned could be
wrong if, for instance, a recently-added row was deleted. I don't know,
however, how else to do this. Should I instead use stored procedures? How
can I add rows to my dataset tables and know what "row ID" the underlying
table will expect during the row insert (especially with other users
potentially hitting the database)? Thanks for advice.