[thelist] Using a "file_ID" that hasn't been crated yet

Todd Richards todd at promisingsites.com
Thu Jan 8 09:25:54 CST 2009

Hi Everyone -

I think I've been too consumed lately and am just not thinking straight.
I'm working on making changes to a site using Classic ASP and SQL 2000

I have a situation where I have a list of groups that are stored in a db
table (aka "groups").  I am adding some articles to the database in a table
called "articles" (primary key of article_ID).  In the form to add/update
the article, a drop down is created in which you can pick multiple groups
that the article can belong to.  I have a table set up called
"group_articles" with two columns - group_ID and article_ID - which contains
the article and the groups that it is published to.  

The situation is that it works great when I update the article, because the
cross query can see what the article_ID is (because it's already been
generated).  However, when I add the new article - it doesn't work right
because the cross query sees the new article as "article_ID = 0".  It does
work, but the group_articles table shows the correct groups associated with
article_ID of 0.  Makes perfect sense but is there a way to do the
rs.Update, get that new article_ID, then use it to update the group_articles
table?  Or should I do it in two steps (create new article, then come back
and publish it to a group)?

I've done this successfully when my primary key is self-generated - i.e.
creating a username and associating it with a group - but I can't think of
the best way to do it when the system is generating the ID.

Of course this all makes sense to me why it doesn't work, but I'm banging my
head on seeing an obvious (or not so obvious) way to fix it.



More information about the thelist mailing list