[thelist] asp & adding db records

David at softv.net David at softv.net
Mon Mar 11 12:18:41 CST 2002


my last post wasn't very helpful...
If you leave out this line:
objRS("user_profile_id") = cInt(temp)
Does the DB not generate a new autonumber for you when you call AddNew?
Check out this page:
http://www.devguru.com/Technologies/ado/quickref/recordset_addnew.html

<%
David Mitchell
Web/Software Developer
david at sofTV.net
sofTV.net
www.sofTV.net
613.729.6400 x268
%>





-----Original Message-----
From: kevin D. white [mailto:kevin.white at bitshift.ws]
Sent: Monday, March 11, 2002 12:25 PM
To: The List
Subject: [thelist] asp & adding db records


-----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-----


--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to:
http://lists.evolt.org Workers of the Web, evolt !



More information about the thelist mailing list