[thelist] Converting VBScript from Access to SQL

Joshua Olson joshua at waetech.com
Wed Nov 20 07:36:01 CST 2002


----- Original Message -----
From: "Wade Armstrong" <wade_lists at runstrong.com>
Sent: Tuesday, November 19, 2002 8:30 PM


> Once you've got that working, come back and we can go over doing inserts
and
> updates the quick way, with straight SQL, instead of using Recordsets.

To add to this suggestion, I'll suggest a trick I use with CF that will
probably work with ASP.  Add an insert trigger to the table that looks
something like this:

CREATE TRIGGER triggername ON table
FOR INSERT
AS SELECT @@identity AS id

Then, in theory, you should be able to do something like this:

strSQL = "INSERT INTO table (name) VALUES ('myname')"
oRS = oConn.Execute(strSQL)
Response.Write "The inserted id is " & oRS("id")

Possible gotcha:  if you are doing a lot of inserts into the table,
performance might be slightly compromised.  But, if you do a lot of inserts,
I'm sure you'll figure out a way to disable the insert trigger first.  :-)

-joshua




More information about the thelist mailing list