[thelist] asp & adding db records

kevin D. white kevin.white at bitshift.ws
Mon Mar 11 11:23:01 CST 2002


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Okay, call me crazy but....

I can't get my ASP code to insert a new record without including an
increment for my Primary Key column.  Here's the kicker, my PK is an
IDENTITY with an automatic increment of 1.  I'm using the latest ADO
on Win2K and MS SQL2000.  The connection is via OLEDB for SQL.  Here
is the basic code snippet:

*********************************
temp = cInt(objRS("user_profile_id")) +1
   response.write temp
   objRS.AddNew
   objRS("user_profile_id") = cInt(temp)
   objRS("up_username") =
request.form("name_first")&"."&request.form("name_last")
   objRS("up_name_first") = request.form("name_first")
   objRS("up_name_last") = request.form("name_last")
   objRS("up_email_addr") = request.form("email_addr")
   objRS("up_date_added") = date
   objRS.Update
********************************

What's the point of using the AddNew method if it bypasses the
autoincrement setting of the table?

BTW, I know I can do this with ad_hoc SQL but I'd like to figure out
this way too.

_________________________________
kevin D. white
email: kevin.white at bitshift.ws

-----BEGIN PGP SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>

iQA/AwUBPIzoSlZZFo27GBIvEQLC+gCeNnVK3sY25iNCs9KAD6m34Yub0+AAoJtT
oPUJHg3DvA3eUl1buSD5GKDi
=6Raz
-----END PGP SIGNATURE-----





More information about the thelist mailing list